diff options
author | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2012-02-27 18:34:24 -0800 |
commit | 9f606f95f03a75961498803e24bee6799a7c0885 (patch) | |
tree | a45f4d74feda9b76277a0c9ced55ad15d82248a1 /src/proguard/shrink/ClassShrinker.java | |
parent | cfead78069f3dc32998dc118ee08cab3867acea2 (diff) | |
download | android_external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.tar.gz android_external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.tar.bz2 android_external_proguard-9f606f95f03a75961498803e24bee6799a7c0885.zip |
Revert "Upgrade from Progaurd 4.4 to 4.7."cm-10.1.3-RC2cm-10.1.3-RC1cm-10.1.3cm-10.1.2cm-10.1.1cm-10.1.0-RC5cm-10.1.0-RC4cm-10.1.0-RC3cm-10.1.0-RC2cm-10.1.0-RC1cm-10.1.0cm-10.1-M3cm-10.1-M2cm-10.1-M1mr1.1-stagingjellybean-stablejellybeancm-10.1
This reverts commit cfead78069f3dc32998dc118ee08cab3867acea2.
Bug: 6079915
Diffstat (limited to 'src/proguard/shrink/ClassShrinker.java')
-rw-r--r-- | src/proguard/shrink/ClassShrinker.java | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/src/proguard/shrink/ClassShrinker.java b/src/proguard/shrink/ClassShrinker.java index f40e3ce..0b5c5b7 100644 --- a/src/proguard/shrink/ClassShrinker.java +++ b/src/proguard/shrink/ClassShrinker.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2009 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 @@ -24,17 +24,15 @@ import proguard.classfile.*; import proguard.classfile.attribute.*; import proguard.classfile.attribute.annotation.*; import proguard.classfile.attribute.annotation.visitor.*; -import proguard.classfile.attribute.visitor.*; +import proguard.classfile.attribute.visitor.AttributeVisitor; import proguard.classfile.constant.*; import proguard.classfile.editor.*; import proguard.classfile.util.*; import proguard.classfile.visitor.*; -import java.util.Arrays; - /** - * This ClassVisitor removes constant pool entries, class members, and other - * class elements that are not marked as being used. + * This ClassVisitor removes constant pool entries and class members that + * are not marked as being used. * * @see UsageMarker * @@ -50,7 +48,8 @@ implements ClassVisitor, { private final UsageMarker usageMarker; - private int[] constantIndexMap = new int[ClassConstants.TYPICAL_CONSTANT_POOL_SIZE]; + private int[] constantIndexMap = new int[ClassConstants.TYPICAL_CONSTANT_POOL_SIZE]; + private final ConstantPoolRemapper constantPoolRemapper = new ConstantPoolRemapper(); @@ -77,7 +76,7 @@ implements ClassVisitor, programClass.u2interfacesCount); // Shrinking the constant pool also sets up an index map. - int newConstantPoolCount = + programClass.u2constantPoolCount = shrinkConstantPool(programClass.constantPool, programClass.u2constantPoolCount); @@ -99,15 +98,9 @@ implements ClassVisitor, programClass.methodsAccept(this); programClass.attributesAccept(this); - // Remap the references to the constant pool if it has shrunk. - if (newConstantPoolCount < programClass.u2constantPoolCount) - { - programClass.u2constantPoolCount = newConstantPoolCount; - - // Remap all constant pool references. - constantPoolRemapper.setConstantIndexMap(constantIndexMap); - constantPoolRemapper.visitProgramClass(programClass); - } + // Remap all constant pool references. + constantPoolRemapper.setConstantIndexMap(constantIndexMap); + constantPoolRemapper.visitProgramClass(programClass); // Remove the unused interfaces from the class signature. programClass.attributesAccept(new SignatureShrinker()); @@ -147,15 +140,6 @@ implements ClassVisitor, public void visitAnyAttribute(Clazz clazz, Attribute attribute) {} - public void visitBootstrapMethodsAttribute(Clazz clazz, BootstrapMethodsAttribute bootstrapMethodsAttribute) - { - // Shrink the array of BootstrapMethodInfo objects. - bootstrapMethodsAttribute.u2bootstrapMethodsCount = - shrinkArray(bootstrapMethodsAttribute.bootstrapMethods, - bootstrapMethodsAttribute.u2bootstrapMethodsCount); - } - - public void visitInnerClassesAttribute(Clazz clazz, InnerClassesAttribute innerClassesAttribute) { // Shrink the array of InnerClassesInfo objects. @@ -365,7 +349,10 @@ implements ClassVisitor, } // Clear the remaining constant pool elements. - Arrays.fill(constantPool, counter, length, null); + for (int index = counter; index < length; index++) + { + constantPool[index] = null; + } return counter; } @@ -390,7 +377,10 @@ implements ClassVisitor, } // Clear the remaining array elements. - Arrays.fill(array, counter, length, 0); + for (int index = counter; index < length; index++) + { + array[index] = 0; + } return counter; } @@ -447,10 +437,10 @@ implements ClassVisitor, } } - // Clear any remaining array elements. - if (counter < length) + // Clear the remaining array elements. + for (int index = counter; index < length; index++) { - Arrays.fill(array, counter, length, null); + array[index] = null; } return counter; |