Package proguard.classfile.editor
Class CodeAttributeEditor
- java.lang.Object
-
- proguard.classfile.editor.CodeAttributeEditor
-
- All Implemented Interfaces:
LocalVariableTargetElementVisitor,TargetInfoVisitor,TypeAnnotationVisitor,StackMapFrameVisitor,VerificationTypeVisitor,AttributeVisitor,ExceptionInfoVisitor,LineNumberInfoVisitor,LocalVariableInfoVisitor,LocalVariableTypeInfoVisitor,InstructionVisitor
public class CodeAttributeEditor extends java.lang.Object implements AttributeVisitor, InstructionVisitor, ExceptionInfoVisitor, StackMapFrameVisitor, VerificationTypeVisitor, LineNumberInfoVisitor, LocalVariableInfoVisitor, LocalVariableTypeInfoVisitor, TypeAnnotationVisitor, TargetInfoVisitor, LocalVariableTargetElementVisitor
ThisAttributeVisitoraccumulates specified changes to code, and then applies these accumulated changes to the code attributes that it visits.The class also supports labels (
label()) and exception handlers (catch_(int,int,int)) in replacement sequences. They provide local branch offsets inside the replacement sequences (CodeAttributeEditor.Label.offset()). For example, replacing a specified instruction in a method by a sequence of instructions, with the help ofInstructionSequenceBuilder:Clazz clazz = ... Method method = ... CodeAttribute codeAttribute = ... int offset = ... CodeAttributeEditor codeAttributeEditor = new CodeAttributeEditor(); InstructionSequenceBuilder builder = new InstructionSequenceBuilder(clazz); // Create labels and instructions. final CodeAttributeEditor.Label TRY_START = codeAttributeEditor.label(); final CodeAttributeEditor.Label TRY_END = codeAttributeEditor.label(); final CodeAttributeEditor.Label CATCH_END = codeAttributeEditor.label(); final CodeAttributeEditor.Label CATCH_EXCEPTION = codeAttributeEditor.catch_(TRY_START.offset(), TRY_END.offset(), constantPoolEditor.addClassConstant("java/lang/Exception", null)); Instructions[] replacementInstructions = builder .label(TRY_START) ...... .label(TRY_END) .goto_(CATCH_END.offset()) .catch_(CATCH_EXCEPTION) ...... .athrow() .label(CATCH_END) ...... .instructions(); // Prepare the editor for this code. codeAttributeEditor.reset(codeAttribute.u4codeLength); // Edit the code -- in this case, replace an instruction. codeAttributeEditor.replaceInstruction(offset, replacementInstructions); // Apply the changes. codeAttributeEditor.visitCodeAttribute(clazz, method, codeAttribute);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCodeAttributeEditor.LabelThis pseudo-instruction represents a label that marks an instruction offset, for use in the context of the code attribute editor only.
-
Field Summary
Fields Modifier and Type Field Description boolean[]deletedInstruction[]postInsertionsInstruction[]preInsertionsInstruction[]preOffsetInsertionsInstruction[]replacementsstatic intRESTORE_PREVIOUS_LINE_NUMBERMagic line number that indicates the previous line number should be restored.
-
Constructor Summary
Constructors Constructor Description CodeAttributeEditor()Creates a new CodeAttributeEditor that automatically updates frame sizes and shrinks instructions.CodeAttributeEditor(boolean updateFrameSizes, boolean shrinkInstructions)Creates a new CodeAttributeEditor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CodeAttributeEditor.Labelcatch_(int startOffset, int endOffset, int catchType)Creates a new catch instance that can be used as a pseudo-instruction to mark the start of an exception handler.CodeAttributeEditor.Labelcatch_(int identifier, int startOffset, int endOffset, int catchType)Creates a new catch instance that can be used as a pseudo-instruction to mark the start of an exception handler.voidclearModifications(int instructionOffset)Clears all modifications of the instruction at the given offset.voiddeleteInstruction(int instructionOffset)Remembers to delete the instruction at the given offset.voidextend(int codeLength)Extends the size of the accumulated code changes.intgetNewOffset(int oldOffset)Get the new offset corresponding to the given old offset.voidinsertAfterInstruction(int instructionOffset, Instruction instruction)Remembers to place the given instruction right after the instruction at the given offset.voidinsertAfterInstruction(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right after the instruction at the given offset.voidinsertBeforeInstruction(int instructionOffset, Instruction instruction)Remembers to place the given instruction right before the instruction at the given offset.voidinsertBeforeInstruction(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right before the instruction at the given offset.voidinsertBeforeOffset(int instructionOffset, Instruction instruction)Remembers to place the given instruction right before the instruction at the given offset.voidinsertBeforeOffset(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right before the instruction at the given offset.booleanisModified()Returns whether the code has been modified in any way.booleanisModified(int instructionOffset)Returns whether the instruction at the given offset has been modified in any way.CodeAttributeEditor.Labellabel()Creates a new label that can be used as a pseudo-instruction to mark a local offset.CodeAttributeEditor.Labellabel(int identifier)Creates a new label that can be used as a pseudo-instruction to mark a local offset.CodeAttributeEditor.Labelline(int lineNumber)Creates a new line number instance that will insert the given line number at the current offset.CodeAttributeEditor.Labelline(int lineNumber, java.lang.String source)Deprecated.CodeAttributeEditor.Labelline(int lineNumber, LineNumberInfoBlock block)Creates a new line number instance that will insert the given line number at the current offset.voidreplaceInstruction(int instructionOffset, Instruction instruction)Remembers to replace the instruction at the given offset by the given instruction.voidreplaceInstruction(int instructionOffset, Instruction[] instructions)Remembers to replace the instruction at the given offset by the given instructions.voidreset(int codeLength)Resets the accumulated code changes for a given anticipated maximum code length.voidundeleteInstruction(int instructionOffset)Remembers not to delete the instruction at the given offset.voidvisitAnyAttribute(Clazz clazz, Attribute attribute)Visits any Attribute instance.voidvisitAnyStackMapFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, StackMapFrame stackMapFrame)Visits any StackMapFrame instance.voidvisitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo)Visits any TargetInfo instance.voidvisitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)Visits any TypeAnnotationsAttribute instance.voidvisitAnyVerificationType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VerificationType verificationType)Visits any VerificationType instance.voidvisitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)voidvisitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)voidvisitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)voidvisitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)voidvisitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)voidvisitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)voidvisitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo)voidvisitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)voidvisitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)voidvisitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)voidvisitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)voidvisitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)voidvisitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)voidvisitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)voidvisitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)voidvisitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)voidvisitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)voidvisitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)voidvisitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)voidvisitStackMapAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapAttribute stackMapAttribute)voidvisitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)voidvisitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)voidvisitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)Visits any TypeAnnotation instance.voidvisitUninitializedType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedType uninitializedType)voidvisitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface proguard.classfile.attribute.visitor.AttributeVisitor
visitAnnotationDefaultAttribute, visitAnyAnnotationsAttribute, visitAnyParameterAnnotationsAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitEnclosingMethodAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitPermittedSubclassesAttribute, visitRecordAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSourceDebugExtensionAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttribute
-
Methods inherited from interface proguard.classfile.instruction.visitor.InstructionVisitor
visitAnyInstruction, visitAnySwitchInstruction
-
Methods inherited from interface proguard.classfile.attribute.preverification.visitor.StackMapFrameVisitor
visitLessZeroFrame, visitSameZeroFrame
-
Methods inherited from interface proguard.classfile.attribute.annotation.target.visitor.TargetInfoVisitor
visitCatchTargetInfo, visitEmptyTargetInfo, visitEmptyTargetInfo, visitEmptyTargetInfo, visitFormalParameterTargetInfo, visitSuperTypeTargetInfo, visitThrowsTargetInfo, visitTypeArgumentTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterTargetInfo, visitTypeParameterTargetInfo
-
Methods inherited from interface proguard.classfile.attribute.annotation.visitor.TypeAnnotationVisitor
visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation
-
Methods inherited from interface proguard.classfile.attribute.preverification.visitor.VerificationTypeVisitor
visitDoubleType, visitFloatType, visitIntegerType, visitLongType, visitNullType, visitObjectType, visitStackDoubleType, visitStackFloatType, visitStackIntegerType, visitStackLongType, visitStackNullType, visitStackObjectType, visitStackTopType, visitStackUninitializedThisType, visitStackUninitializedType, visitTopType, visitUninitializedThisType, visitVariablesDoubleType, visitVariablesFloatType, visitVariablesIntegerType, visitVariablesLongType, visitVariablesNullType, visitVariablesObjectType, visitVariablesTopType, visitVariablesUninitializedThisType, visitVariablesUninitializedType
-
-
-
-
Field Detail
-
RESTORE_PREVIOUS_LINE_NUMBER
public static final int RESTORE_PREVIOUS_LINE_NUMBER
Magic line number that indicates the previous line number should be restored. The restored line number is the first preceding line number with a different source.- See Also:
- Constant Field Values
-
preOffsetInsertions
public Instruction[] preOffsetInsertions
-
preInsertions
public Instruction[] preInsertions
-
replacements
public Instruction[] replacements
-
postInsertions
public Instruction[] postInsertions
-
deleted
public boolean[] deleted
-
-
Constructor Detail
-
CodeAttributeEditor
public CodeAttributeEditor()
Creates a new CodeAttributeEditor that automatically updates frame sizes and shrinks instructions.
-
CodeAttributeEditor
public CodeAttributeEditor(boolean updateFrameSizes, boolean shrinkInstructions)Creates a new CodeAttributeEditor.- Parameters:
updateFrameSizes- specifies whether frame sizes of edited code should be updated.shrinkInstructions- specifies whether added instructions should automatically be shrunk before being written.
-
-
Method Detail
-
reset
public void reset(int codeLength)
Resets the accumulated code changes for a given anticipated maximum code length. If necessary, the size may still be extended while editing the code, withextend(int).- Parameters:
codeLength- the length of the code that will be edited next.
-
extend
public void extend(int codeLength)
Extends the size of the accumulated code changes.- Parameters:
codeLength- the length of the code that will be edited next.
-
insertBeforeOffset
public void insertBeforeOffset(int instructionOffset, Instruction instruction)Remembers to place the given instruction right before the instruction at the given offset. Any branches to the existing instruction will land after the new instruction. Similarly, any try blocks that start at the existing instruction will not include the new instruction. However, any try blocks that end right before the existing instruction wil now include the new instruction.- Parameters:
instructionOffset- the offset of the instruction.instruction- the new instruction.
-
insertBeforeInstruction
public void insertBeforeInstruction(int instructionOffset, Instruction instruction)Remembers to place the given instruction right before the instruction at the given offset. Any branches to the existing instruction will also go to the new instruction. Similarly, any try blocks that include the existing instruction will also include the new instruction.- Parameters:
instructionOffset- the offset of the instruction.instruction- the new instruction.
-
insertBeforeOffset
public void insertBeforeOffset(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right before the instruction at the given offset. Any branches to the existing instruction will land after the new instructions. Similarly, any try blocks that start at the existing instruction will not include the new instructions. However, any try blocks that end right before the existing instruction wil now include the new instructions.- Parameters:
instructionOffset- the offset of the instruction.instructions- the new instructions.
-
insertBeforeInstruction
public void insertBeforeInstruction(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right before the instruction at the given offset. Any branches to the existing instruction will also go to the new instructions. Similarly, any try blocks that include the existing instruction will also include the new instructions.- Parameters:
instructionOffset- the offset of the instruction.instructions- the new instructions.
-
replaceInstruction
public void replaceInstruction(int instructionOffset, Instruction instruction)Remembers to replace the instruction at the given offset by the given instruction.- Parameters:
instructionOffset- the offset of the instruction to be replaced.instruction- the new instruction.
-
replaceInstruction
public void replaceInstruction(int instructionOffset, Instruction[] instructions)Remembers to replace the instruction at the given offset by the given instructions.- Parameters:
instructionOffset- the offset of the instruction to be replaced.instructions- the new instructions.
-
insertAfterInstruction
public void insertAfterInstruction(int instructionOffset, Instruction instruction)Remembers to place the given instruction right after the instruction at the given offset.- Parameters:
instructionOffset- the offset of the instruction.instruction- the new instruction.
-
insertAfterInstruction
public void insertAfterInstruction(int instructionOffset, Instruction[] instructions)Remembers to place the given instructions right after the instruction at the given offset.- Parameters:
instructionOffset- the offset of the instruction.instructions- the new instructions.
-
deleteInstruction
public void deleteInstruction(int instructionOffset)
Remembers to delete the instruction at the given offset.- Parameters:
instructionOffset- the offset of the instruction to be deleted.
-
undeleteInstruction
public void undeleteInstruction(int instructionOffset)
Remembers not to delete the instruction at the given offset.- Parameters:
instructionOffset- the offset of the instruction not to be deleted.
-
clearModifications
public void clearModifications(int instructionOffset)
Clears all modifications of the instruction at the given offset.- Parameters:
instructionOffset- the offset of the instruction to be deleted.
-
isModified
public boolean isModified()
Returns whether the code has been modified in any way.
-
isModified
public boolean isModified(int instructionOffset)
Returns whether the instruction at the given offset has been modified in any way.
-
getNewOffset
public int getNewOffset(int oldOffset)
Get the new offset corresponding to the given old offset. Throws an exception if no new offset is found.
-
visitAnyAttribute
public void visitAnyAttribute(Clazz clazz, Attribute attribute)
Description copied from interface:AttributeVisitorVisits any Attribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyAttributein interfaceAttributeVisitor
-
visitCodeAttribute
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- Specified by:
visitCodeAttributein interfaceAttributeVisitor
-
visitCodeAttribute0
public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)
-
visitStackMapAttribute
public void visitStackMapAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapAttribute stackMapAttribute)
- Specified by:
visitStackMapAttributein interfaceAttributeVisitor
-
visitStackMapTableAttribute
public void visitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)
- Specified by:
visitStackMapTableAttributein interfaceAttributeVisitor
-
visitLineNumberTableAttribute
public void visitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)
- Specified by:
visitLineNumberTableAttributein interfaceAttributeVisitor
-
visitLocalVariableTableAttribute
public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- Specified by:
visitLocalVariableTableAttributein interfaceAttributeVisitor
-
visitLocalVariableTypeTableAttribute
public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- Specified by:
visitLocalVariableTypeTableAttributein interfaceAttributeVisitor
-
visitAnyTypeAnnotationsAttribute
public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
Description copied from interface:AttributeVisitorVisits any TypeAnnotationsAttribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyTypeAnnotationsAttributein interfaceAttributeVisitor
-
visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
- Specified by:
visitSimpleInstructionin interfaceInstructionVisitor
-
visitConstantInstruction
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
- Specified by:
visitConstantInstructionin interfaceInstructionVisitor
-
visitVariableInstruction
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
- Specified by:
visitVariableInstructionin interfaceInstructionVisitor
-
visitBranchInstruction
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
- Specified by:
visitBranchInstructionin interfaceInstructionVisitor
-
visitTableSwitchInstruction
public void visitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)
- Specified by:
visitTableSwitchInstructionin interfaceInstructionVisitor
-
visitLookUpSwitchInstruction
public void visitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)
- Specified by:
visitLookUpSwitchInstructionin interfaceInstructionVisitor
-
visitExceptionInfo
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- Specified by:
visitExceptionInfoin interfaceExceptionInfoVisitor
-
visitAnyStackMapFrame
public void visitAnyStackMapFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, StackMapFrame stackMapFrame)
Description copied from interface:StackMapFrameVisitorVisits any StackMapFrame instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyStackMapFramein interfaceStackMapFrameVisitor
-
visitSameOneFrame
public void visitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)
- Specified by:
visitSameOneFramein interfaceStackMapFrameVisitor
-
visitMoreZeroFrame
public void visitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)
- Specified by:
visitMoreZeroFramein interfaceStackMapFrameVisitor
-
visitFullFrame
public void visitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)
- Specified by:
visitFullFramein interfaceStackMapFrameVisitor
-
visitAnyVerificationType
public void visitAnyVerificationType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VerificationType verificationType)
Description copied from interface:VerificationTypeVisitorVisits any VerificationType instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyVerificationTypein interfaceVerificationTypeVisitor
-
visitUninitializedType
public void visitUninitializedType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedType uninitializedType)
- Specified by:
visitUninitializedTypein interfaceVerificationTypeVisitor
-
visitLineNumberInfo
public void visitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo)
- Specified by:
visitLineNumberInfoin interfaceLineNumberInfoVisitor
-
visitLocalVariableInfo
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- Specified by:
visitLocalVariableInfoin interfaceLocalVariableInfoVisitor
-
visitLocalVariableTypeInfo
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- Specified by:
visitLocalVariableTypeInfoin interfaceLocalVariableTypeInfoVisitor
-
visitTypeAnnotation
public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
Description copied from interface:TypeAnnotationVisitorVisits any TypeAnnotation instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitTypeAnnotationin interfaceTypeAnnotationVisitor
-
visitAnyTargetInfo
public void visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo)
Description copied from interface:TargetInfoVisitorVisits any TargetInfo instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyTargetInfoin interfaceTargetInfoVisitor
-
visitLocalVariableTargetInfo
public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
- Specified by:
visitLocalVariableTargetInfoin interfaceTargetInfoVisitor
-
visitOffsetTargetInfo
public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
- Specified by:
visitOffsetTargetInfoin interfaceTargetInfoVisitor
-
visitLocalVariableTargetElement
public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
- Specified by:
visitLocalVariableTargetElementin interfaceLocalVariableTargetElementVisitor
-
label
public CodeAttributeEditor.Label label()
Creates a new label that can be used as a pseudo-instruction to mark a local offset. Its offset can be used as a branch target in replacement instructions (CodeAttributeEditor.Label.offset()).
-
label
public CodeAttributeEditor.Label label(int identifier)
Creates a new label that can be used as a pseudo-instruction to mark a local offset. Its offset can be used as a branch target in replacement instructions (CodeAttributeEditor.Label.offset()).
-
catch_
public CodeAttributeEditor.Label catch_(int startOffset, int endOffset, int catchType)
Creates a new catch instance that can be used as a pseudo-instruction to mark the start of an exception handler. Its offset can be used as a branch target in replacement instructions (CodeAttributeEditor.Label.offset()).
-
catch_
public CodeAttributeEditor.Label catch_(int identifier, int startOffset, int endOffset, int catchType)
Creates a new catch instance that can be used as a pseudo-instruction to mark the start of an exception handler. Its offset can be used as a branch target in replacement instructions (CodeAttributeEditor.Label.offset()).
-
line
public CodeAttributeEditor.Label line(int lineNumber)
Creates a new line number instance that will insert the given line number at the current offset.
-
line
@Deprecated public CodeAttributeEditor.Label line(int lineNumber, java.lang.String source)
Deprecated.Creates a new line number instance that will insert the given line number at the current offset. It will insert an extended line number info with the given source if it's not null.
-
line
public CodeAttributeEditor.Label line(int lineNumber, LineNumberInfoBlock block)
Creates a new line number instance that will insert the given line number at the current offset. It will insert structured line number info belonging to the given block if it's not null.
-
-