proguard.classfile.editor.ConstantPoolEditor Java Examples
The following examples show how to use
proguard.classfile.editor.ConstantPoolEditor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassRenamer.java From proguard with GNU General Public License v2.0 | 6 votes |
public void visitProgramMember(ProgramClass programClass, ProgramMember programMember) { // Has the class member name changed? String name = programMember.getName(programClass); String newName = MemberObfuscator.newMemberName(programMember); if (newName != null && !newName.equals(name)) { programMember.u2nameIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newName); if (extraMemberVisitor != null) { programMember.accept(programClass, extraMemberVisitor); } } }
Example #2
Source File: ClassRenamer.java From proguard with GNU General Public License v2.0 | 6 votes |
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Update the Class entry if required. String name = clazz.getName(); String newName = ClassObfuscator.newClassName(clazz); if (newName != null && !newName.equals(name)) { // Refer to a new Utf8 entry. classConstant.u2nameIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newName); if (extraClassVisitor != null) { clazz.accept(extraClassVisitor); } } }
Example #3
Source File: MethodDescriptorShrinker.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { // Compute the new signature. String signature = clazz.getString(signatureAttribute.u2signatureIndex); String newSignature = shrinkDescriptor(method, signature); // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); // Update the referenced classes. signatureAttribute.referencedClasses = shrinkReferencedClasses(method, signature, signatureAttribute.referencedClasses); }
Example #4
Source File: TargetClassChanger.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Explicitly adds a new class constant for the given class in the given * program class. */ private int addNewClassConstant(ProgramClass programClass, String className, Clazz referencedClass) { ConstantPoolEditor constantPoolEditor = new ConstantPoolEditor(programClass); int nameIndex = constantPoolEditor.addUtf8Constant(className); int classConstantIndex = constantPoolEditor.addConstant(new ClassConstant(nameIndex, referencedClass)); return classConstantIndex; }
Example #5
Source File: DuplicateInitializerFixer.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { String descriptor = method.getDescriptor(clazz); int descriptorIndex = descriptor.indexOf(TypeConstants.METHOD_ARGUMENTS_CLOSE); String signature = signatureAttribute.getSignature(clazz); int signatureIndex = signature.indexOf(TypeConstants.METHOD_ARGUMENTS_CLOSE); String newSignature = signature.substring(0, signatureIndex) + descriptor.charAt(descriptorIndex - 1) + signature.substring(signatureIndex); // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); }
Example #6
Source File: ClassRenamer.java From bazel with Apache License 2.0 | 5 votes |
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Update the Class entry if required. String newName = ClassObfuscator.newClassName(clazz); if (newName != null) { // Refer to a new Utf8 entry. classConstant.u2nameIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newName); } }
Example #7
Source File: ClassRenamer.java From bazel with Apache License 2.0 | 5 votes |
public void visitProgramMember(ProgramClass programClass, ProgramMember programMember) { // Has the class member name changed? String name = programMember.getName(programClass); String newName = MemberObfuscator.newMemberName(programMember); if (newName != null && !newName.equals(name)) { programMember.u2nameIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newName); } }
Example #8
Source File: MethodDescriptorShrinker.java From bazel with Apache License 2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { if (DEBUG) { System.out.println(" ["+signatureAttribute.getSignature(clazz)+"]"); } // Compute the new signature. String signature = signatureAttribute.getSignature(clazz); String newSignature = shrinkDescriptor(method, signature); if (!newSignature.equals(signature)) { // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); // Update the referenced classes. signatureAttribute.referencedClasses = shrinkReferencedClasses(method, signature, signatureAttribute.referencedClasses); if (DEBUG) { System.out.println(" -> ["+newSignature+"]"); } } }
Example #9
Source File: DuplicateInitializerFixer.java From bazel with Apache License 2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { String descriptor = method.getDescriptor(clazz); int descriptorIndex = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE); String signature = signatureAttribute.getSignature(clazz); int signatureIndex = signature.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE); String newSignature = signature.substring(0, signatureIndex) + descriptor.charAt(descriptorIndex - 1) + signature.substring(signatureIndex); // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); }
Example #10
Source File: ClassRenamer.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Update the Class entry if required. String newName = ClassObfuscator.newClassName(clazz); if (newName != null) { // Refer to a new Utf8 entry. classConstant.u2nameIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newName); } }
Example #11
Source File: ClassRenamer.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitProgramMember(ProgramClass programClass, ProgramMember programMember) { // Has the class member name changed? String name = programMember.getName(programClass); String newName = MemberObfuscator.newMemberName(programMember); if (newName != null && !newName.equals(name)) { programMember.u2nameIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newName); } }
Example #12
Source File: MethodDescriptorShrinker.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { if (DEBUG) { System.out.println(" ["+signatureAttribute.getSignature(clazz)+"]"); } // Compute the new signature. String signature = signatureAttribute.getSignature(clazz); String newSignature = shrinkDescriptor(method, signature); if (!newSignature.equals(signature)) { // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); // Update the referenced classes. signatureAttribute.referencedClasses = shrinkReferencedClasses(method, signature, signatureAttribute.referencedClasses); if (DEBUG) { System.out.println(" -> ["+newSignature+"]"); } } }
Example #13
Source File: DuplicateInitializerFixer.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { String descriptor = method.getDescriptor(clazz); int descriptorIndex = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE); String signature = signatureAttribute.getSignature(clazz); int signatureIndex = signature.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE); String newSignature = signature.substring(0, signatureIndex) + descriptor.charAt(descriptorIndex - 1) + signature.substring(signatureIndex); // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); }
Example #14
Source File: ClassRenamer.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Update the Class entry if required. String newName = ClassObfuscator.newClassName(clazz); if (newName != null) { // Refer to a new Utf8 entry. classConstant.u2nameIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newName); } }
Example #15
Source File: ClassRenamer.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public void visitProgramMember(ProgramClass programClass, ProgramMember programMember) { // Has the class member name changed? String name = programMember.getName(programClass); String newName = MemberObfuscator.newMemberName(programMember); if (newName != null && !newName.equals(name)) { programMember.u2nameIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newName); } }
Example #16
Source File: DuplicateInitializerFixer.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { String descriptor = method.getDescriptor(clazz); int descriptorIndex = descriptor.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE); String signature = clazz.getString(signatureAttribute.u2signatureIndex); int signatureIndex = signature.indexOf(ClassConstants.INTERNAL_METHOD_ARGUMENTS_CLOSE); String newSignature = signature.substring(0, signatureIndex) + descriptor.charAt(descriptorIndex - 1) + signature.substring(signatureIndex); // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); }
Example #17
Source File: MethodDescriptorShrinker.java From proguard with GNU General Public License v2.0 | 5 votes |
public void visitSignatureAttribute(Clazz clazz, Method method, SignatureAttribute signatureAttribute) { if (DEBUG) { System.out.println(" ["+signatureAttribute.getSignature(clazz)+"]"); } // Compute the new signature. String signature = signatureAttribute.getSignature(clazz); // Constructors of enum classes and of non-static inner classes may // start with one or two synthetic parameters, which are not part // of the signature. int syntheticParametersSize = new InternalTypeEnumeration(method.getDescriptor(clazz)).typesSize() - new InternalTypeEnumeration(signature).typesSize(); String newSignature = shrinkDescriptor(method, signature, syntheticParametersSize); if (!newSignature.equals(signature)) { // Update the signature. signatureAttribute.u2signatureIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSignature); // Update the referenced classes. signatureAttribute.referencedClasses = shrinkReferencedClasses(method, signature, syntheticParametersSize, signatureAttribute.referencedClasses); if (DEBUG) { System.out.println(" -> ["+newSignature+"]"); } } }
Example #18
Source File: CodePreverifier.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Finds or creates a class constant for the given reference value, and * returns its index in the constant pool. */ private int createClassConstant(ProgramClass programClass, ReferenceValue referenceValue) { return new ConstantPoolEditor(programClass).addClassConstant(referenceValue.getType(), referenceValue.getReferencedClass()); }
Example #19
Source File: SourceFileRenamer.java From bazel with Apache License 2.0 | 4 votes |
public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute) { // Fix the source file attribute. sourceDirAttribute.u2sourceDirIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #20
Source File: SourceFileRenamer.java From bazel with Apache License 2.0 | 4 votes |
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { // Fix the source file attribute. sourceFileAttribute.u2sourceFileIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #21
Source File: DuplicateInitializerFixer.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Is it a class instance initializer? String name = programMethod.getName(programClass); if (name.equals(ClassConstants.METHOD_NAME_INIT)) { // Is there already another initializer with the same descriptor? String descriptor = programMethod.getDescriptor(programClass); Method similarMethod = programClass.findMethod(name, descriptor); if (!programMethod.equals(similarMethod)) { // Should this initializer be preserved? if (KeepMarker.isKept(programMethod)) { // Fix the other initializer. // We'll just proceed if it is being kept as well; // apparently the descriptor types didn't matter so much. programMethod = (ProgramMethod)similarMethod; } int index = descriptor.indexOf(TypeConstants.METHOD_ARGUMENTS_CLOSE); // Try to find a new, unique descriptor. int typeCounter = 0; while (true) { // Construct the new descriptor by inserting a new type // as an additional last argument. StringBuffer newDescriptorBuffer = new StringBuffer(descriptor.substring(0, index)); for (int arrayDimension = 0; arrayDimension < typeCounter / TYPES.length; arrayDimension++) { newDescriptorBuffer.append(TypeConstants.ARRAY); } newDescriptorBuffer.append(TYPES[typeCounter % TYPES.length]); newDescriptorBuffer.append(descriptor.substring(index)); String newDescriptor = newDescriptorBuffer.toString(); // Is the new initializer descriptor unique? if (programClass.findMethod(name, newDescriptor) == null) { if (DEBUG) { System.out.println("DuplicateInitializerFixer:"); System.out.println(" ["+programClass.getName()+"."+name+descriptor+"] ("+ClassUtil.externalClassAccessFlags(programMethod.getAccessFlags())+") -> ["+newDescriptor+"]"); } // Update the descriptor. programMethod.u2descriptorIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newDescriptor); // Fix the local variable frame size, the method // signature, and the parameter annotations, if // necessary. programMethod.attributesAccept(programClass, this); // Update the optimization info. MethodOptimizationInfo methodOptimizationInfo = ProgramMethodOptimizationInfo.getMethodOptimizationInfo(programMethod); if (methodOptimizationInfo instanceof ProgramMethodOptimizationInfo) { ProgramMethodOptimizationInfo programMethodOptimizationInfo = (ProgramMethodOptimizationInfo)methodOptimizationInfo; int parameterCount = ClassUtil.internalMethodParameterCount(newDescriptor, programMethod.getAccessFlags()); programMethodOptimizationInfo.insertParameter(parameterCount - 1); int parameterSize = programMethodOptimizationInfo.getParameterSize(); programMethodOptimizationInfo.setParameterSize(parameterSize + 1); programMethodOptimizationInfo.setParameterUsed(parameterSize); } // Visit the initializer, if required. if (extraFixedInitializerVisitor != null) { extraFixedInitializerVisitor.visitProgramMethod(programClass, programMethod); } // We're done with this constructor. return; } typeCounter++; } } } }
Example #22
Source File: MethodDescriptorShrinker.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (DEBUG) { System.out.println("MethodDescriptorShrinker: ["+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass)+"]"); } // Update the descriptor if it has any unused parameters. String descriptor = programMethod.getDescriptor(programClass); String newDescriptor = shrinkDescriptor(programMethod, descriptor, 0); if (!newDescriptor.equals(descriptor)) { // Shrink the signature and parameter annotations, // before shrinking the descriptor itself. programMethod.attributesAccept(programClass, this); String name = programMethod.getName(programClass); String newName = name; // Append a code, if the method isn't a class instance initializer. if (!name.equals(ClassConstants.METHOD_NAME_INIT)) { newName += TypeConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode())); } ConstantPoolEditor constantPoolEditor = new ConstantPoolEditor(programClass); // Update the name, if necessary. if (!newName.equals(name)) { programMethod.u2nameIndex = constantPoolEditor.addUtf8Constant(newName); } // Update the referenced classes. programMethod.referencedClasses = shrinkReferencedClasses(programMethod, descriptor, 0, programMethod.referencedClasses); // Finally, update the descriptor itself. programMethod.u2descriptorIndex = constantPoolEditor.addUtf8Constant(newDescriptor); if (DEBUG) { System.out.println(" -> ["+newName+newDescriptor+"]"); } // Visit the method, if required. if (extraMemberVisitor != null) { extraMemberVisitor.visitProgramMethod(programClass, programMethod); } } }
Example #23
Source File: MethodDescriptorShrinker.java From bazel with Apache License 2.0 | 4 votes |
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (DEBUG) { System.out.println("MethodDescriptorShrinker: ["+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass)+"]"); } // Update the descriptor if it has any unused parameters. String descriptor = programMethod.getDescriptor(programClass); String newDescriptor = shrinkDescriptor(programMethod, descriptor); if (!newDescriptor.equals(descriptor)) { // Shrink the signature and parameter annotations, // before shrinking the descriptor itself. programMethod.attributesAccept(programClass, this); String name = programMethod.getName(programClass); String newName = name; // Append a code, if the method isn't a class instance initializer. if (!name.equals(ClassConstants.METHOD_NAME_INIT)) { newName += ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode())); } ConstantPoolEditor constantPoolEditor = new ConstantPoolEditor(programClass); // Update the name, if necessary. if (!newName.equals(name)) { programMethod.u2nameIndex = constantPoolEditor.addUtf8Constant(newName); } // Update the referenced classes. programMethod.referencedClasses = shrinkReferencedClasses(programMethod, descriptor, programMethod.referencedClasses); // Finally, update the descriptor itself. programMethod.u2descriptorIndex = constantPoolEditor.addUtf8Constant(newDescriptor); if (DEBUG) { System.out.println(" -> ["+newName+newDescriptor+"]"); } // Visit the method, if required. if (extraMemberVisitor != null) { extraMemberVisitor.visitProgramMethod(programClass, programMethod); } } }
Example #24
Source File: SourceFileRenamer.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { // Fix the source file attribute. sourceFileAttribute.u2sourceFileIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #25
Source File: DuplicateInitializerFixer.java From bazel with Apache License 2.0 | 4 votes |
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Is it a class instance initializer? String name = programMethod.getName(programClass); if (name.equals(ClassConstants.METHOD_NAME_INIT)) { // Is there already another initializer with the same descriptor? String descriptor = programMethod.getDescriptor(programClass); Method similarMethod = programClass.findMethod(name, descriptor); if (!programMethod.equals(similarMethod)) { // Should this initializer be preserved? if (KeepMarker.isKept(programMethod)) { // Fix the other initializer. programMethod = (ProgramMethod)similarMethod; } int index = descriptor.indexOf(ClassConstants.METHOD_ARGUMENTS_CLOSE); // Try to find a new, unique descriptor. int typeCounter = 0; while (true) { // Construct the new descriptor by inserting a new type // as an additional last argument. StringBuffer newDescriptorBuffer = new StringBuffer(descriptor.substring(0, index)); for (int arrayDimension = 0; arrayDimension < typeCounter / TYPES.length; arrayDimension++) { newDescriptorBuffer.append(ClassConstants.TYPE_ARRAY); } newDescriptorBuffer.append(TYPES[typeCounter % TYPES.length]); newDescriptorBuffer.append(descriptor.substring(index)); String newDescriptor = newDescriptorBuffer.toString(); // Is the new initializer descriptor unique? if (programClass.findMethod(name, newDescriptor) == null) { if (DEBUG) { System.out.println("DuplicateInitializerFixer:"); System.out.println(" ["+programClass.getName()+"."+name+descriptor+"] ("+ClassUtil.externalClassAccessFlags(programMethod.getAccessFlags())+") -> ["+newDescriptor+"]"); } // Update the descriptor. programMethod.u2descriptorIndex = new ConstantPoolEditor(programClass).addUtf8Constant(newDescriptor); // Fix the local variable frame size, the method // signature, and the parameter annotations, if // necessary. programMethod.attributesAccept(programClass, this); // Visit the initializer, if required. if (extraFixedInitializerVisitor != null) { extraFixedInitializerVisitor.visitProgramMethod(programClass, programMethod); } // We're done with this constructor. return; } typeCounter++; } } } }
Example #26
Source File: SourceFileRenamer.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute) { // Fix the source file attribute. sourceDirAttribute.u2sourceDirIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #27
Source File: SourceFileRenamer.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { // Fix the source file attribute. sourceFileAttribute.u2sourceFileIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #28
Source File: SourceFileRenamer.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute) { // Fix the source file attribute. sourceDirAttribute.u2sourceDirIndex = new ConstantPoolEditor((ProgramClass)clazz).addUtf8Constant(newSourceFileAttribute); }
Example #29
Source File: EvaluationSimplifier.java From java-n-IDE-for-Android with Apache License 2.0 | 4 votes |
/** * Replaces the integer pushing instruction at the given offset by a simpler * push instruction, if possible. */ private void replaceIntegerPushInstruction(Clazz clazz, int offset, Instruction instruction, int maxVariableIndex) { Value pushedValue = partialEvaluator.getStackAfter(offset).getTop(0); if (pushedValue.isParticular()) { int value = pushedValue.integerValue().value(); if (value << 16 >> 16 == value) { replaceConstantPushInstruction(clazz, offset, instruction, InstructionConstants.OP_SIPUSH, value); } else { ConstantPoolEditor constantPoolEditor = new ConstantPoolEditor((ProgramClass)clazz); Instruction replacementInstruction = new ConstantInstruction(InstructionConstants.OP_LDC, constantPoolEditor.addIntegerConstant(value)).shrink(); replaceInstruction(clazz, offset, instruction, replacementInstruction); } } else if (pushedValue.isSpecific()) { TracedVariables variables = partialEvaluator.getVariablesBefore(offset); for (int variableIndex = 0; variableIndex < maxVariableIndex; variableIndex++) { if (pushedValue.equals(variables.load(variableIndex))) { replaceVariablePushInstruction(clazz, offset, instruction, InstructionConstants.OP_ILOAD, variableIndex); } } } }
Example #30
Source File: MethodDescriptorShrinker.java From proguard with GNU General Public License v2.0 | 4 votes |
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (DEBUG) { System.out.println("MethodDescriptorShrinker: ["+programClass.getName()+"."+programMethod.getName(programClass)+programMethod.getDescriptor(programClass)+"]"); } // Update the descriptor if it has any unused parameters. String descriptor = programMethod.getDescriptor(programClass); String newDescriptor = shrinkDescriptor(programMethod, descriptor); if (!newDescriptor.equals(descriptor)) { // Shrink the signature and parameter annotations, // before shrinking the descriptor itself. programMethod.attributesAccept(programClass, this); String name = programMethod.getName(programClass); String newName = name; // Append a code, if the method isn't a class instance initializer. if (!name.equals(ClassConstants.METHOD_NAME_INIT)) { newName += ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode())); } ConstantPoolEditor constantPoolEditor = new ConstantPoolEditor(programClass); // Update the name, if necessary. if (!newName.equals(name)) { programMethod.u2nameIndex = constantPoolEditor.addUtf8Constant(newName); } // Update the referenced classes. programMethod.referencedClasses = shrinkReferencedClasses(programMethod, descriptor, programMethod.referencedClasses); // Finally, update the descriptor itself. programMethod.u2descriptorIndex = constantPoolEditor.addUtf8Constant(newDescriptor); if (DEBUG) { System.out.println(" -> ["+newName+newDescriptor+"]"); } // Visit the method, if required. if (extraMemberVisitor != null) { extraMemberVisitor.visitProgramMethod(programClass, programMethod); } } }