diff options
author | Brian Carlstrom <bdc@google.com> | 2015-01-08 08:24:06 -0800 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2015-01-08 09:27:15 -0800 |
commit | 2270795fbe0b277bfd49f40950ecaa78583175cc (patch) | |
tree | 9ac962825d41c4fb8ad1ec0fc2e8b441b42d3869 /src/proguard/classfile/editor/ConstantPoolRemapper.java | |
parent | 9961286c06c25cd03464d3e2b00bd9b9dedf96ba (diff) | |
download | external_proguard-2270795fbe0b277bfd49f40950ecaa78583175cc.tar.gz external_proguard-2270795fbe0b277bfd49f40950ecaa78583175cc.tar.bz2 external_proguard-2270795fbe0b277bfd49f40950ecaa78583175cc.zip |
Upgrade Proguard to 5.1.
Downloaded from:
http://sourceforge.net/projects/proguard/files/proguard/5.1/
Bug: 17550647
Change-Id: I2b4eab16eb7821fc232b294ab7f433aae08f71e1
Diffstat (limited to 'src/proguard/classfile/editor/ConstantPoolRemapper.java')
-rw-r--r-- | src/proguard/classfile/editor/ConstantPoolRemapper.java | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/proguard/classfile/editor/ConstantPoolRemapper.java b/src/proguard/classfile/editor/ConstantPoolRemapper.java index eaf7653..e033c30 100644 --- a/src/proguard/classfile/editor/ConstantPoolRemapper.java +++ b/src/proguard/classfile/editor/ConstantPoolRemapper.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 @@ -53,6 +53,7 @@ implements ClassVisitor, InstructionVisitor, StackMapFrameVisitor, VerificationTypeVisitor, + ParameterInfoVisitor, LocalVariableInfoVisitor, LocalVariableTypeInfoVisitor, AnnotationVisitor, @@ -333,6 +334,16 @@ implements ClassVisitor, } + public void visitMethodParametersAttribute(Clazz clazz, Method method, MethodParametersAttribute methodParametersAttribute) + { + methodParametersAttribute.u2attributeNameIndex = + remapConstantIndex(methodParametersAttribute.u2attributeNameIndex); + + // Remap the constant pool references of the parameter information. + methodParametersAttribute.parametersAccept(clazz, method, this); + } + + public void visitExceptionsAttribute(Clazz clazz, Method method, ExceptionsAttribute exceptionsAttribute) { exceptionsAttribute.u2attributeNameIndex = @@ -552,6 +563,15 @@ implements ClassVisitor, } + // Implementations for ParameterInfoVisitor. + + public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo) + { + parameterInfo.u2nameIndex = + remapConstantIndex(parameterInfo.u2nameIndex); + } + + // Implementations for LocalVariableInfoVisitor. public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo) @@ -569,7 +589,7 @@ implements ClassVisitor, { localVariableTypeInfo.u2nameIndex = remapConstantIndex(localVariableTypeInfo.u2nameIndex); - localVariableTypeInfo.u2signatureIndex = + localVariableTypeInfo.u2signatureIndex = remapConstantIndex(localVariableTypeInfo.u2signatureIndex); } @@ -637,8 +657,6 @@ implements ClassVisitor, } - // Small utility methods. - /** * Remaps all constant pool indices in the given array. */ @@ -650,6 +668,8 @@ implements ClassVisitor, } } + // Small utility methods. + /** * Returns the new constant pool index of the entry at the @@ -657,6 +677,12 @@ implements ClassVisitor, */ private int remapConstantIndex(int constantIndex) { - return constantIndexMap[constantIndex]; + int remappedConstantIndex = constantIndexMap[constantIndex]; + if (remappedConstantIndex < 0) + { + throw new IllegalArgumentException("Can't remap constant index ["+constantIndex+"]"); + } + + return remappedConstantIndex; } } |