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
ThisAttributeVisitor
accumulates 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 class
CodeAttributeEditor.Label
This 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[]
deleted
Instruction[]
postInsertions
Instruction[]
preInsertions
Instruction[]
preOffsetInsertions
Instruction[]
replacements
-
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 Modifier and Type Method Description 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.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.void
clearModifications(int instructionOffset)
Clears all modifications of the instruction at the given offset.void
deleteInstruction(int instructionOffset)
Remembers to delete the instruction at the given offset.void
extend(int codeLength)
Extends the size of the accumulated code changes.int
getNewOffset(int oldOffset)
Get the new offset corresponding to the given old offset.void
insertAfterInstruction(int instructionOffset, Instruction instruction)
Remembers to place the given instruction right after the instruction at the given offset.void
insertAfterInstruction(int instructionOffset, Instruction[] instructions)
Remembers to place the given instructions right after the instruction at the given offset.void
insertBeforeInstruction(int instructionOffset, Instruction instruction)
Remembers to place the given instruction right before the instruction at the given offset.void
insertBeforeInstruction(int instructionOffset, Instruction[] instructions)
Remembers to place the given instructions right before the instruction at the given offset.void
insertBeforeOffset(int instructionOffset, Instruction instruction)
Remembers to place the given instruction right before the instruction at the given offset.void
insertBeforeOffset(int instructionOffset, Instruction[] instructions)
Remembers to place the given instructions right before the instruction at the given offset.boolean
isModified()
Returns whether the code has been modified in any way.boolean
isModified(int instructionOffset)
Returns whether the instruction at the given offset has been modified in any way.CodeAttributeEditor.Label
label()
Creates a new label that can be used as a pseudo-instruction to mark a local offset.CodeAttributeEditor.Label
label(int identifier)
Creates a new label that can be used as a pseudo-instruction to mark a local offset.CodeAttributeEditor.Label
line(int lineNumber)
Creates a new line number instance that will insert the given line number at the current offset.CodeAttributeEditor.Label
line(int identifier, int lineNumber, java.lang.String source)
Creates a new line number instance that will insert the given line number at the current offset.CodeAttributeEditor.Label
line(int lineNumber, java.lang.String source)
Creates a new line number instance that will insert the given line number at the current offset.void
replaceInstruction(int instructionOffset, Instruction instruction)
Remembers to replace the instruction at the given offset by the given instruction.void
replaceInstruction(int instructionOffset, Instruction[] instructions)
Remembers to replace the instruction at the given offset by the given instructions.void
reset(int codeLength)
Resets the accumulated code changes for a given anticipated maximum code length.void
undeleteInstruction(int instructionOffset)
Remembers not to delete the instruction at the given offset.void
visitAnyAttribute(Clazz clazz, Attribute attribute)
Visits any Attribute instance.void
visitAnyStackMapFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, StackMapFrame stackMapFrame)
Visits any StackMapFrame instance.void
visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo)
Visits any TargetInfo instance.void
visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
Visits any TypeAnnotationsAttribute instance.void
visitAnyVerificationType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VerificationType verificationType)
Visits any VerificationType instance.void
visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
void
visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
void
visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)
void
visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
void
visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
void
visitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)
void
visitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo)
void
visitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)
void
visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
void
visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
void
visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
void
visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
void
visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
void
visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
void
visitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)
void
visitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)
void
visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
void
visitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)
void
visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
void
visitStackMapAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapAttribute stackMapAttribute)
void
visitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)
void
visitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)
void
visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
Visits any TypeAnnotation instance.void
visitUninitializedType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedType uninitializedType)
void
visitVariableInstruction(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
-
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:AttributeVisitor
Visits any Attribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyAttribute
in interfaceAttributeVisitor
-
visitCodeAttribute
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
- Specified by:
visitCodeAttribute
in 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:
visitStackMapAttribute
in interfaceAttributeVisitor
-
visitStackMapTableAttribute
public void visitStackMapTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, StackMapTableAttribute stackMapTableAttribute)
- Specified by:
visitStackMapTableAttribute
in interfaceAttributeVisitor
-
visitLineNumberTableAttribute
public void visitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)
- Specified by:
visitLineNumberTableAttribute
in interfaceAttributeVisitor
-
visitLocalVariableTableAttribute
public void visitLocalVariableTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTableAttribute localVariableTableAttribute)
- Specified by:
visitLocalVariableTableAttribute
in interfaceAttributeVisitor
-
visitLocalVariableTypeTableAttribute
public void visitLocalVariableTypeTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeTableAttribute localVariableTypeTableAttribute)
- Specified by:
visitLocalVariableTypeTableAttribute
in interfaceAttributeVisitor
-
visitAnyTypeAnnotationsAttribute
public void visitAnyTypeAnnotationsAttribute(Clazz clazz, TypeAnnotationsAttribute typeAnnotationsAttribute)
Description copied from interface:AttributeVisitor
Visits any TypeAnnotationsAttribute instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyTypeAnnotationsAttribute
in interfaceAttributeVisitor
-
visitSimpleInstruction
public void visitSimpleInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SimpleInstruction simpleInstruction)
- Specified by:
visitSimpleInstruction
in interfaceInstructionVisitor
-
visitConstantInstruction
public void visitConstantInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, ConstantInstruction constantInstruction)
- Specified by:
visitConstantInstruction
in interfaceInstructionVisitor
-
visitVariableInstruction
public void visitVariableInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VariableInstruction variableInstruction)
- Specified by:
visitVariableInstruction
in interfaceInstructionVisitor
-
visitBranchInstruction
public void visitBranchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, BranchInstruction branchInstruction)
- Specified by:
visitBranchInstruction
in interfaceInstructionVisitor
-
visitTableSwitchInstruction
public void visitTableSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, TableSwitchInstruction tableSwitchInstruction)
- Specified by:
visitTableSwitchInstruction
in interfaceInstructionVisitor
-
visitLookUpSwitchInstruction
public void visitLookUpSwitchInstruction(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, LookUpSwitchInstruction lookUpSwitchInstruction)
- Specified by:
visitLookUpSwitchInstruction
in interfaceInstructionVisitor
-
visitExceptionInfo
public void visitExceptionInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, ExceptionInfo exceptionInfo)
- Specified by:
visitExceptionInfo
in interfaceExceptionInfoVisitor
-
visitAnyStackMapFrame
public void visitAnyStackMapFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, StackMapFrame stackMapFrame)
Description copied from interface:StackMapFrameVisitor
Visits any StackMapFrame instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyStackMapFrame
in interfaceStackMapFrameVisitor
-
visitSameOneFrame
public void visitSameOneFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, SameOneFrame sameOneFrame)
- Specified by:
visitSameOneFrame
in interfaceStackMapFrameVisitor
-
visitMoreZeroFrame
public void visitMoreZeroFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, MoreZeroFrame moreZeroFrame)
- Specified by:
visitMoreZeroFrame
in interfaceStackMapFrameVisitor
-
visitFullFrame
public void visitFullFrame(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, FullFrame fullFrame)
- Specified by:
visitFullFrame
in interfaceStackMapFrameVisitor
-
visitAnyVerificationType
public void visitAnyVerificationType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, VerificationType verificationType)
Description copied from interface:VerificationTypeVisitor
Visits any VerificationType instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyVerificationType
in interfaceVerificationTypeVisitor
-
visitUninitializedType
public void visitUninitializedType(Clazz clazz, Method method, CodeAttribute codeAttribute, int offset, UninitializedType uninitializedType)
- Specified by:
visitUninitializedType
in interfaceVerificationTypeVisitor
-
visitLineNumberInfo
public void visitLineNumberInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberInfo lineNumberInfo)
- Specified by:
visitLineNumberInfo
in interfaceLineNumberInfoVisitor
-
visitLocalVariableInfo
public void visitLocalVariableInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableInfo localVariableInfo)
- Specified by:
visitLocalVariableInfo
in interfaceLocalVariableInfoVisitor
-
visitLocalVariableTypeInfo
public void visitLocalVariableTypeInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, LocalVariableTypeInfo localVariableTypeInfo)
- Specified by:
visitLocalVariableTypeInfo
in interfaceLocalVariableTypeInfoVisitor
-
visitTypeAnnotation
public void visitTypeAnnotation(Clazz clazz, TypeAnnotation typeAnnotation)
Description copied from interface:TypeAnnotationVisitor
Visits any TypeAnnotation instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitTypeAnnotation
in interfaceTypeAnnotationVisitor
-
visitAnyTargetInfo
public void visitAnyTargetInfo(Clazz clazz, TypeAnnotation typeAnnotation, TargetInfo targetInfo)
Description copied from interface:TargetInfoVisitor
Visits any TargetInfo instance. The more specific default implementations of this interface delegate to this method.- Specified by:
visitAnyTargetInfo
in interfaceTargetInfoVisitor
-
visitLocalVariableTargetInfo
public void visitLocalVariableTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo)
- Specified by:
visitLocalVariableTargetInfo
in interfaceTargetInfoVisitor
-
visitOffsetTargetInfo
public void visitOffsetTargetInfo(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, OffsetTargetInfo offsetTargetInfo)
- Specified by:
visitOffsetTargetInfo
in interfaceTargetInfoVisitor
-
visitLocalVariableTargetElement
public void visitLocalVariableTargetElement(Clazz clazz, Method method, CodeAttribute codeAttribute, TypeAnnotation typeAnnotation, LocalVariableTargetInfo localVariableTargetInfo, LocalVariableTargetElement localVariableTargetElement)
- Specified by:
visitLocalVariableTargetElement
in 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
public CodeAttributeEditor.Label line(int lineNumber, java.lang.String source)
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 identifier, int lineNumber, java.lang.String source)
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.
-
-