public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { // Update the descriptor if it has any unused parameters. String descriptor = programMethod.getDescriptor(programClass); String newDescriptor = shrinkDescriptor(programMethod, descriptor); if (!descriptor.equals(newDescriptor)) { // Shrink the signature and parameter annotations. 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.INTERNAL_METHOD_NAME_INIT)) { newName += ClassConstants.SPECIAL_MEMBER_SEPARATOR + Long.toHexString(Math.abs((descriptor).hashCode())); } if (DEBUG) { System.out.println("MethodDescriptorShrinker:"); System.out.println(" Class file = " + programClass.getName()); System.out.println(" Method name = " + name); System.out.println(" -> " + newName); System.out.println(" Method descriptor = " + descriptor); System.out.println(" -> " + newDescriptor); } 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); // Visit the method, if required. if (extraMemberVisitor != null) { extraMemberVisitor.visitProgramMethod(programClass, programMethod); } } }
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod) { if (usageMarker.isUsed(programMethod)) { memberVisitor.visitProgramMethod(programClass, programMethod); } }
public void visitLibraryMethod(LibraryClass libraryClass, LibraryMethod libraryMethod) { if (usageMarker.isUsed(libraryMethod)) { memberVisitor.visitLibraryMethod(libraryClass, libraryMethod); } }
public void accept(ProgramClass programClass, MemberVisitor memberVisitor) { memberVisitor.visitProgramField(programClass, this); }