diff options
author | Brian Carlstrom <bdc@google.com> | 2015-01-09 00:45:23 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-09 00:45:23 +0000 |
commit | 6af8f1004e0efe02a138286a34e833d1f3d227d7 (patch) | |
tree | 9ac962825d41c4fb8ad1ec0fc2e8b441b42d3869 /src/proguard/classfile/editor/NameAndTypeShrinker.java | |
parent | 9961286c06c25cd03464d3e2b00bd9b9dedf96ba (diff) | |
parent | cd9e071098d0539dda3a4a5d3f45cfd8814de4ed (diff) | |
download | proguard-6af8f1004e0efe02a138286a34e833d1f3d227d7.tar.gz |
Merge "Upgrade Proguard to 5.1."
Diffstat (limited to 'src/proguard/classfile/editor/NameAndTypeShrinker.java')
-rw-r--r-- | src/proguard/classfile/editor/NameAndTypeShrinker.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/proguard/classfile/editor/NameAndTypeShrinker.java b/src/proguard/classfile/editor/NameAndTypeShrinker.java index 650f9ba..40181b2 100644 --- a/src/proguard/classfile/editor/NameAndTypeShrinker.java +++ b/src/proguard/classfile/editor/NameAndTypeShrinker.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2014 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 @@ -25,7 +25,6 @@ import proguard.classfile.attribute.*; import proguard.classfile.attribute.visitor.AttributeVisitor; import proguard.classfile.constant.*; import proguard.classfile.constant.visitor.ConstantVisitor; -import proguard.classfile.editor.ConstantPoolRemapper; import proguard.classfile.util.SimplifiedVisitor; import proguard.classfile.visitor.ClassVisitor; @@ -163,11 +162,10 @@ implements ClassVisitor, // Shift the used constant pool entries together. for (int index = 1; index < length; index++) { - constantIndexMap[index] = counter; - Constant constant = constantPool[index]; - // Don't update the flag if this is the second half of a long entry. + // Is the constant being used? Don't update the flag if this is the + // second half of a long entry. if (constant != null) { isUsed = constant.getTag() != ClassConstants.CONSTANT_NameAndType || @@ -176,8 +174,17 @@ implements ClassVisitor, if (isUsed) { + // Remember the new index. + constantIndexMap[index] = counter; + + // Shift the constant pool entry. constantPool[counter++] = constant; } + else + { + // Remember an invalid index. + constantIndexMap[index] = -1; + } } // Clear the remaining constant pool elements. |