/** * Creates a new ExceptionAdder that will copy exceptions into the given * target code attribute. */ public ExceptionInfoAdder(ProgramClass targetClass, CodeAttributeComposer targetComposer) { constantAdder = new ConstantAdder(targetClass); codeAttributeComposer = targetComposer; }
public void visitEnclosingMethodAttribute(Clazz clazz, EnclosingMethodAttribute enclosingMethodAttribute) { // Create a copy of the attribute. EnclosingMethodAttribute newEnclosingMethodAttribute = new EnclosingMethodAttribute(constantAdder.addConstant(clazz, enclosingMethodAttribute.u2attributeNameIndex), constantAdder.addConstant(clazz, enclosingMethodAttribute.u2classIndex), enclosingMethodAttribute.u2nameAndTypeIndex == 0 ? 0 : constantAdder.addConstant(clazz, enclosingMethodAttribute.u2nameAndTypeIndex)); newEnclosingMethodAttribute.referencedClass = enclosingMethodAttribute.referencedClass; newEnclosingMethodAttribute.referencedMethod = enclosingMethodAttribute.referencedMethod; // Add it to the target class. attributesEditor.addAttribute(newEnclosingMethodAttribute); }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Add a class constant to the constant pool. constantAdder.visitClassConstant(clazz, classConstant); // Add the index of the class constant to the list of exceptions. exceptionsAttributeEditor.addException(constantAdder.getConstantIndex()); } }
/** * Creates a new InstructionAdder that will copy classes into the given * target code attribute. */ public InstructionAdder(ProgramClass targetClass, CodeAttributeComposer targetComposer) { constantAdder = new ConstantAdder(targetClass); codeAttributeComposer = targetComposer; }
public void visitSourceDirAttribute(Clazz clazz, SourceDirAttribute sourceDirAttribute) { // Create a copy of the attribute. SourceDirAttribute newSourceDirAttribute = new SourceDirAttribute(constantAdder.addConstant(clazz, sourceDirAttribute.u2attributeNameIndex), constantAdder.addConstant(clazz, sourceDirAttribute.u2sourceDirIndex)); // Add it to the target class. attributesEditor.addAttribute(newSourceDirAttribute); }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Add a class constant to the constant pool. constantAdder.visitClassConstant(clazz, classConstant); // Add the index of the class constant to the list of exceptions. exceptionsAttributeEditor.addException(constantAdder.getConstantIndex()); } }
/** * Creates a new ExceptionAdder that will copy exceptions into the given * target code attribute. */ public ExceptionInfoAdder(ProgramClass targetClass, CodeAttributeComposer targetComposer) { constantAdder = new ConstantAdder(targetClass); codeAttributeComposer = targetComposer; }
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { // Create a copy of the attribute. SourceFileAttribute newSourceFileAttribute = new SourceFileAttribute(constantAdder.addConstant(clazz, sourceFileAttribute.u2attributeNameIndex), constantAdder.addConstant(clazz, sourceFileAttribute.u2sourceFileIndex)); // Add it to the target class. attributesEditor.addAttribute(newSourceFileAttribute); }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Add a class constant to the constant pool. constantAdder.visitClassConstant(clazz, classConstant); // Add the index of the class constant to the list of exceptions. exceptionsAttributeEditor.addException(constantAdder.getConstantIndex()); } }
/** * Creates a new InstructionAdder that will copy classes into the given * target code attribute. */ public InstructionAdder(ProgramClass targetClass, CodeAttributeComposer targetComposer) { constantAdder = new ConstantAdder(targetClass); codeAttributeComposer = targetComposer; }
public void visitSignatureAttribute(Clazz clazz, SignatureAttribute signatureAttribute) { // Create a copy of the attribute. SignatureAttribute newSignatureAttribute = new SignatureAttribute(constantAdder.addConstant(clazz, signatureAttribute.u2attributeNameIndex), constantAdder.addConstant(clazz, signatureAttribute.u2signatureIndex)); newSignatureAttribute.referencedClasses = signatureAttribute.referencedClasses; // Add it to the target. attributesEditor.addAttribute(newSignatureAttribute); }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { // Add a class constant to the constant pool. constantAdder.visitClassConstant(clazz, classConstant); // Add the index of the class constant to the list of exceptions. exceptionsAttributeEditor.addException(constantAdder.getConstantIndex()); } }
/** * Creates a new ParameterInfoAdder that will copy parameter information * into the given target method parameters attribute. */ public ParameterInfoAdder(ProgramClass targetClass, MethodParametersAttribute targetMethodParametersAttribute) { this.constantAdder = new ConstantAdder(targetClass); this.targetMethodParametersAttribute = targetMethodParametersAttribute; }
public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo) { // Create a new parameter. int newNameIndex = parameterInfo.u2nameIndex == 0 ? 0 : constantAdder.addConstant(clazz, parameterInfo.u2nameIndex); ParameterInfo newParameterInfo = new ParameterInfo(newNameIndex, parameterInfo.u2accessFlags); // Add it to the target. targetMethodParametersAttribute.parameters[parameterIndex] = newParameterInfo; } }
/** * Creates a new ParameterInfoAdder that will copy parameter information * into the given target method parameters attribute. */ public ParameterInfoAdder(ProgramClass targetClass, MethodParametersAttribute targetMethodParametersAttribute) { this.constantAdder = new ConstantAdder(targetClass); this.targetMethodParametersAttribute = targetMethodParametersAttribute; }
public void visitClassConstant(Clazz clazz, ClassConstant classConstant) { interfacesEditor.addInterface(constantAdder.addConstant(clazz, classConstant)); } }
/** * Creates a new TypeAnnotationAdder that will copy annotations into the given * target annotation element value. */ public TypeAnnotationAdder(ProgramClass targetClass, AnnotationElementValue targetAnnotationElementValue) { this.targetClass = targetClass; this.targetAnnotationElementValue = targetAnnotationElementValue; this.annotationsAttributeEditor = null; constantAdder = new ConstantAdder(targetClass); }
public void visitParameterInfo(Clazz clazz, Method method, int parameterIndex, ParameterInfo parameterInfo) { // Create a new parameter. int newNameIndex = parameterInfo.u2nameIndex == 0 ? 0 : constantAdder.addConstant(clazz, parameterInfo.u2nameIndex); ParameterInfo newParameterInfo = new ParameterInfo(newNameIndex, parameterInfo.u2accessFlags); // Add it to the target. targetMethodParametersAttribute.parameters[parameterIndex] = newParameterInfo; } }
/** * Creates a new TypeAnnotationAdder that will copy annotations into the given * target annotation element value. */ public TypeAnnotationAdder(ProgramClass targetClass, AnnotationElementValue targetAnnotationElementValue) { this.targetClass = targetClass; this.targetAnnotationElementValue = targetAnnotationElementValue; this.annotationsAttributeEditor = null; constantAdder = new ConstantAdder(targetClass); }
public void visitSourceFileAttribute(Clazz clazz, SourceFileAttribute sourceFileAttribute) { // Create a copy of the attribute. SourceFileAttribute newSourceFileAttribute = new SourceFileAttribute(constantAdder.addConstant(clazz, sourceFileAttribute.u2attributeNameIndex), constantAdder.addConstant(clazz, sourceFileAttribute.u2sourceFileIndex)); // Add it to the target class. attributesEditor.addAttribute(newSourceFileAttribute); }