diff options
author | Ying Wang <wangying@google.com> | 2012-02-27 10:21:35 -0800 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2012-02-27 11:54:51 -0800 |
commit | cfead78069f3dc32998dc118ee08cab3867acea2 (patch) | |
tree | 9600f15eed62fa9ba63ce5894d1f09fe686d5997 /src/proguard/obfuscate/Obfuscator.java | |
parent | 10aa7224f49abe49d123bde5d34346202d49aaca (diff) | |
download | android_external_proguard-cfead78069f3dc32998dc118ee08cab3867acea2.tar.gz android_external_proguard-cfead78069f3dc32998dc118ee08cab3867acea2.tar.bz2 android_external_proguard-cfead78069f3dc32998dc118ee08cab3867acea2.zip |
Upgrade from Progaurd 4.4 to 4.7.
Change-Id: Ie185d0be411a80cc6a330cafa8547252a7dc1d9c
You can find the changelog here
http://proguard.sourceforge.net/#downloads.html
Diffstat (limited to 'src/proguard/obfuscate/Obfuscator.java')
-rw-r--r-- | src/proguard/obfuscate/Obfuscator.java | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/proguard/obfuscate/Obfuscator.java b/src/proguard/obfuscate/Obfuscator.java index dce563a..5f58a83 100644 --- a/src/proguard/obfuscate/Obfuscator.java +++ b/src/proguard/obfuscate/Obfuscator.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -99,19 +99,30 @@ public class Obfuscator libraryClassPool.classesAccept(new AllMemberVisitor(nameMarker)); // Mark attributes that have to be kept. - AttributeUsageMarker requiredAttributeUsageMarker = - new AttributeUsageMarker(); + AttributeVisitor attributeUsageMarker = + new NonEmptyAttributeFilter( + new AttributeUsageMarker()); AttributeVisitor optionalAttributeUsageMarker = configuration.keepAttributes == null ? null : new AttributeNameFilter(new ListParser(new NameParser()).parse(configuration.keepAttributes), - requiredAttributeUsageMarker); + attributeUsageMarker); programClassPool.classesAccept( new AllAttributeVisitor(true, - new RequiredAttributeFilter(requiredAttributeUsageMarker, + new RequiredAttributeFilter(attributeUsageMarker, optionalAttributeUsageMarker))); + // Keep parameter names and types if specified. + if (configuration.keepParameterNames) + { + programClassPool.classesAccept( + new AllMethodVisitor( + new MemberNameFilter( + new AllAttributeVisitor(true, + new ParameterNameMarker(attributeUsageMarker))))); + } + // Remove the attributes that can be discarded. Note that the attributes // may only be discarded after the seeds have been marked, since the // configuration may rely on annotations. @@ -398,23 +409,28 @@ public class Obfuscator programClassPool.classesAccept( new AllConstantVisitor( new AccessFixer())); + + // Fix the access flags of the inner classes information. + programClassPool.classesAccept( + new AllAttributeVisitor( + new AllInnerClassesInfoVisitor( + new InnerClassesAccessFixer()))); } + // Fix the bridge method flags. + programClassPool.classesAccept( + new AllMethodVisitor( + new BridgeMethodFixer())); + // Rename the source file attributes, if requested. if (configuration.newSourceFileAttribute != null) { programClassPool.classesAccept(new SourceFileRenamer(configuration.newSourceFileAttribute)); } - // Mark NameAndType constant pool entries that have to be kept - // and remove the other ones. - programClassPool.classesAccept(new NameAndTypeUsageMarker()); - programClassPool.classesAccept(new NameAndTypeShrinker()); - - // Mark Utf8 constant pool entries that have to be kept - // and remove the other ones. - programClassPool.classesAccept(new Utf8UsageMarker()); - programClassPool.classesAccept(new Utf8Shrinker()); + // Remove unused constants. + programClassPool.classesAccept( + new ConstantPoolShrinker()); } |