Top Description Fields Constructors Methods
net.bytebuddy.utility.visitor

public Class StackAwareMethodVisitor

extends MethodVisitor
Class Inheritance
Imports
edu.umd.cs.findbugs.annotations.SuppressFBWarnings, net.bytebuddy.build.AccessControllerPlugin, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.implementation.bytecode.StackSize, net.bytebuddy.utility.CompoundList, .OpenedClassReader, net.bytebuddy.utility.nullability.MaybeNull, net.bytebuddy.utility.privilege.GetSystemPropertyAction, net.bytebuddy.jar.asm.*, java.security.PrivilegedAction, java.util.*

A method visitor that is aware of the current size of the operand stack at all times. Additionally, this method takes care of maintaining an index for the next currently unused index of the local variable array.

Important Note

It is not always possible to apply this method visitor if it is applied to a class file compiled for Java 5 or earlier, or if frames are computed by ASM and not passed to this visitor, if a method also contains Opcodes#GOTO instructions. In the latter case, the stack is assumed empty after the instruction. If this is a problem, stack adjustment can be disabled by setting StackAwareMethodVisitor#UNADJUSTED_PROPERTY to true. With this setting, Byte Buddy does no longer attempt draining non-empty stacks and skips this visitor in all cases. This might however lead to verification problems if stacks are left non-empty. As the latter happens more common and since this visitor is applied defensively, using this wrapper is considered the more sensible default.

Field Summary

Modifier and TypeField and Description
private List<StackSize>
current

A list of the current elements on the operand stack.

private int
freeIndex

The next index of the local variable array that is available.

private static final int[]
SIZE_CHANGE

An array mapping any opcode to its size impact onto the operand stack.

private final Map<Label, List<StackSize>>
sizes

A mapping of labels to the operand stack size that is expected at this label.

public static final boolean
UNADJUSTED

true if stack adjustment is disabled.

public static final String
UNADJUSTED_PROPERTY

A property to disable stack adjustment.

Inherited from net.bytebuddy.jar.asm.MethodVisitor:
apimv

Constructor Summary

AccessConstructor and Description
protected
StackAwareMethodVisitor(MethodVisitor
The method visitor to delegate operations to.
methodVisitor
,
MethodDescription
The method description for which this method visitor is applied.
instrumentedMethod
)

Creates a new stack aware method visitor.

Method Summary

Modifier and TypeMethod and Description
private void
adjustStack(int
The change of the current operation of the operand stack. Must not be larger than 2.
delta
)

Adjusts the current state of the operand stack.

private void
adjustStack(int
The change of the current operation of the operand stack. Must not be larger than 2.
delta
,
int
The offset of the value within the operand stack. Must be bigger then 0 and smaller than the current stack size. Only permitted if the supplied delta is positive.
offset
)

Adjusts the current state of the operand stack.

private void
doDrain(List<StackSize>
The stack sizes of the elements to drain.
stackSizes
)

Drains all supplied elements of the operand stack.

private static <
The type of the action's resolved value.
T
>
T

Returns:

The action's resolved value.
doPrivileged
(PrivilegedAction<T>
The action to execute from a privileged context.
action
)

A proxy for java.security.AccessController#doPrivileged that is activated if available.

public void
drainStack()

Pops all values currently on the stack.

public int

Returns:

The minimal size of the local variable array that is required to perform the operation.
drainStack
(int
The opcode used for storing the top value.
store
,
int
The opcode used for loading the top value.
load
,
StackSize
The size of the value on top of the operand stack.
size
)

Drains the stack to only contain the top value.

public static MethodVisitor

Returns:

An appropriate
of
(MethodVisitor
The method visitor to delegate operations to.
methodVisitor
,
MethodDescription
The method description for which this method visitor is applied.
instrumentedMethod
)

Wraps the provided method visitor within a stack aware method visitor.

public void
register(Label
The label to register a stack state for.
label
,
List<StackSize>
The stack sizes to assume when reaching the supplied label.
stackSizes
)

Explicitly registers a label to define a given stack state.

public void
visitFieldInsn(int
the opcode of the type instruction to be visited. This opcode is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.
opcode
,
String
the internal name of the field's owner class (see Type#getInternalName()).
owner
,
String
the field's name.
name
,
String
the field's descriptor (see Type).
descriptor
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitFieldInsn.

Visits a field instruction.
public void
visitFrame(int
the type of this stack map frame. Must be Opcodes#F_NEW for expanded frames, or Opcodes#F_FULL, Opcodes#F_APPEND, Opcodes#F_CHOP, Opcodes#F_SAME or Opcodes#F_APPEND, Opcodes#F_SAME1 for compressed frames.
type
,
int
the number of local variables in the visited frame. Long and double values count for one variable.
localVariableLength
,
Object[]
the local variable types in this frame. This array must not be modified. Primitive types are represented by Opcodes#TOP, Opcodes#INTEGER, Opcodes#FLOAT, Opcodes#LONG, Opcodes#DOUBLE, Opcodes#NULL or Opcodes#UNINITIALIZED_THIS (long and double are represented by a single element). Reference types are represented by String objects (representing internal names, see Type#getInternalName()), and uninitialized types by Label objects (this label designates the NEW instruction that created this uninitialized value).
localVariable
,
int
the number of operand stack elements in the visited frame. Long and double values count for one stack element.
stackSize
,
Object[]
the operand stack types in this frame. This array must not be modified. Its content has the same format as the "local" array.
stack
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitFrame.

Visits the current state of the local variables and operand stack elements.
public void
visitInsn(int
the opcode of the instruction to be visited. This opcode is either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT.
opcode
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitInsn.

Visits a zero operand instruction.
public void
visitIntInsn(int
the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH or NEWARRAY.
opcode
,
int
the operand of the instruction to be visited.
When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE.
When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE.
When opcode is NEWARRAY, operand value should be one of Opcodes#T_BOOLEAN, Opcodes#T_CHAR, Opcodes#T_FLOAT, Opcodes#T_DOUBLE, Opcodes#T_BYTE, Opcodes#T_SHORT, Opcodes#T_INT or Opcodes#T_LONG.
operand
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitIntInsn.

Visits an instruction with a single int operand.
public void
visitInvokeDynamicInsn(String
the method's name.
name
,
String
the method's descriptor (see Type).
descriptor
,
Handle
the bootstrap method.
bootstrap
,
Object...
the bootstrap method constant arguments. Each argument must be an Integer, Float, Long, Double, String, Type, Handle or ConstantDynamic value. This method is allowed to modify the content of the array so a caller should expect that this array may change.
bootstrapArguments
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitInvokeDynamicInsn.

Visits an invokedynamic instruction.
public void
visitJumpInsn(int
the opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.
opcode
,
Label
the operand of the instruction to be visited. This operand is a label that designates the instruction to which the jump instruction may jump.
label
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitJumpInsn.

Visits a jump instruction.
public void
visitLabel(Label
a Label object.
label
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLabel.

Visits a label.
public void
visitLdcInsn(Object
the constant to be loaded on the stack. This parameter must be a non null Integer, a Float, a Long, a Double, a String, a Type of OBJECT or ARRAY sort for .class constants, for classes whose version is 49, a Type of METHOD sort for MethodType, a Handle for MethodHandle constants, for classes whose version is 51 or a ConstantDynamic for a constant dynamic for classes whose version is 55.
value
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLdcInsn.

Visits a LDC instruction.
public void
visitLineNumber(int
a line number. This number refers to the source file from which the class was compiled.
line
,
Label
the first instruction corresponding to this line number.
start
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLineNumber.

Visits a line number declaration.
public void
visitLookupSwitchInsn(Label
beginning of the default handler block.
defaultOption
,
int[]
the values of the keys.
key
,
Label[]
beginnings of the handler blocks. labels[i] is the beginning of the handler block for the keys[i] key.
option
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLookupSwitchInsn.

Visits a LOOKUPSWITCH instruction.
public void
visitMethodInsn(int
the opcode of the type instruction to be visited. This opcode is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
opcode
,
String
the internal name of the method's owner class (see Type#getInternalName()).
owner
,
String
the method's name.
name
,
String
the method's descriptor (see Type).
descriptor
,
boolean
if the method's owner class is an interface.
isInterface
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitMethodInsn.

Visits a method instruction.
public void
visitMultiANewArrayInsn(String
an array type descriptor (see Type).
descriptor
,
int
the number of dimensions of the array to allocate.
dimension
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitMultiANewArrayInsn.

Visits a MULTIANEWARRAY instruction.
public void
visitTableSwitchInsn(int
the minimum key value.
minimum
,
int
the maximum key value.
maximum
,
Label
beginning of the default handler block.
defaultOption
,
Label...
beginnings of the handler blocks. labels[i] is the beginning of the handler block for the min + i key.
option
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTableSwitchInsn.

Visits a TABLESWITCH instruction.
public void
visitTryCatchBlock(Label
the beginning of the exception handler's scope (inclusive).
start
,
Label
the end of the exception handler's scope (exclusive).
end
,
Label
the beginning of the exception handler's code.
handler
,
String
the internal name of the type of exceptions handled by the handler (see Type#getInternalName()), or null to catch any exceptions (for "finally" blocks).
type
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTryCatchBlock.

Visits a try catch block.
public void
visitTypeInsn(int
the opcode of the type instruction to be visited. This opcode is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.
opcode
,
String
the operand of the instruction to be visited. This operand must be the internal name of an object or array class (see Type#getInternalName()).
type
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTypeInsn.

Visits a type instruction.
public void
visitVarInsn(int
the opcode of the local variable instruction to be visited. This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.
opcode
,
int
the operand of the instruction to be visited. This operand is the index of a local variable.
variable
)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitVarInsn.

Visits a local variable instruction.
Inherited from net.bytebuddy.jar.asm.MethodVisitor:
getDelegatevisitAnnotableParameterCountvisitAnnotationvisitAnnotationDefaultvisitAttributevisitCodevisitEndvisitIincInsnvisitInsnAnnotationvisitLocalVariablevisitLocalVariableAnnotationvisitMaxsvisitMethodInsnvisitParametervisitParameterAnnotationvisitTryCatchAnnotationvisitTypeAnnotation

Field Detail

currentback to summary
private List<StackSize> current

A list of the current elements on the operand stack.

freeIndexback to summary
private int freeIndex

The next index of the local variable array that is available.

SIZE_CHANGEback to summary
private static final int[] SIZE_CHANGE

An array mapping any opcode to its size impact onto the operand stack. This mapping is taken from net.bytebuddy.jar.asm.Frame with the difference that the Opcodes#JSR instruction is mapped to a size of 0 as it does not impact the stack after returning from the instruction.

sizesback to summary
private final Map<Label, List<StackSize>> sizes

A mapping of labels to the operand stack size that is expected at this label. Lists stored in this map must not be mutated.

UNADJUSTEDback to summary
public static final boolean UNADJUSTED

true if stack adjustment is disabled.

UNADJUSTED_PROPERTYback to summary
public static final String UNADJUSTED_PROPERTY

A property to disable stack adjustment. Stack adjustment is typically needed when instrumenting other generated code that leaves excess values on the stack. This is also often the case when byte code obfuscation is used.

Constructor Detail

StackAwareMethodVisitorback to summary
protected StackAwareMethodVisitor(MethodVisitor methodVisitor, MethodDescription instrumentedMethod)

Creates a new stack aware method visitor.

Parameters
methodVisitor:MethodVisitor

The method visitor to delegate operations to.

instrumentedMethod:MethodDescription

The method description for which this method visitor is applied.

Method Detail

adjustStackback to summary
private void adjustStack(int delta)

Adjusts the current state of the operand stack.

Parameters
delta:int

The change of the current operation of the operand stack. Must not be larger than 2.

adjustStackback to summary
private void adjustStack(int delta, int offset)

Adjusts the current state of the operand stack.

Parameters
delta:int

The change of the current operation of the operand stack. Must not be larger than 2.

offset:int

The offset of the value within the operand stack. Must be bigger then 0 and smaller than the current stack size. Only permitted if the supplied delta is positive.

doDrainback to summary
private void doDrain(List<StackSize> stackSizes)

Drains all supplied elements of the operand stack.

Parameters
stackSizes:List<StackSize>

The stack sizes of the elements to drain.

doPrivilegedback to summary
private static <T> T doPrivileged(PrivilegedAction<T> action)

A proxy for java.security.AccessController#doPrivileged that is activated if available.

Parameters
<T>
The type of the action's resolved value.
action:PrivilegedAction<T>

The action to execute from a privileged context.

Returns:T

The action's resolved value.

Annotations
@Enhance
drainStackback to summary
public void drainStack()

Pops all values currently on the stack.

drainStackback to summary
public int drainStack(int store, int load, StackSize size)

Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed back onto the operand stack.

Parameters
store:int

The opcode used for storing the top value.

load:int

The opcode used for loading the top value.

size:StackSize

The size of the value on top of the operand stack.

Returns:int

The minimal size of the local variable array that is required to perform the operation.

ofback to summary
public static MethodVisitor of(MethodVisitor methodVisitor, MethodDescription instrumentedMethod)

Wraps the provided method visitor within a stack aware method visitor.

Parameters
methodVisitor:MethodVisitor

The method visitor to delegate operations to.

instrumentedMethod:MethodDescription

The method description for which this method visitor is applied.

Returns:MethodVisitor

An appropriate

registerback to summary
public void register(Label label, List<StackSize> stackSizes)

Explicitly registers a label to define a given stack state.

Parameters
label:Label

The label to register a stack state for.

stackSizes:List<StackSize>

The stack sizes to assume when reaching the supplied label.

visitFieldInsnback to summary
public void visitFieldInsn(int opcode, String owner, String name, String descriptor)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitFieldInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitFieldInsn.

Visits a field instruction. A field instruction is an instruction that loads or stores the value of a field of an object.

Parameters
opcode:int

the opcode of the type instruction to be visited. This opcode is either GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.

owner:String

the internal name of the field's owner class (see Type#getInternalName()).

name:String

the field's name.

descriptor:String

the field's descriptor (see Type).

Annotations
@Override
visitFrameback to summary
public void visitFrame(int type, int localVariableLength, Object[] localVariable, int stackSize, Object[] stack)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitFrame.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitFrame.

Visits the current state of the local variables and operand stack elements. This method must(*) be called just before any instruction i that follows an unconditional branch instruction such as GOTO or THROW, that is the target of a jump instruction, or that starts an exception handler block. The visited types must describe the values of the local variables and of the operand stack elements just before i is executed.

(*) this is mandatory only for classes whose version is greater than or equal to Opcodes#V1_6.

The frames of a method must be given either in expanded form, or in compressed form (all frames must use the same format, i.e. you must not mix expanded and compressed frames within a single method):

  • In expanded form, all frames must have the F_NEW type.
  • In compressed form, frames are basically "deltas" from the state of the previous frame:
    • Opcodes#F_SAME representing frame with exactly the same locals as the previous frame and with the empty stack.
    • Opcodes#F_SAME1 representing frame with exactly the same locals as the previous frame and with single value on the stack ( numStack is 1 and stack[0] contains value for the type of the stack item).
    • Opcodes#F_APPEND representing frame with current locals are the same as the locals in the previous frame, except that additional locals are defined ( numLocal is 1, 2 or 3 and local elements contains values representing added types).
    • Opcodes#F_CHOP representing frame with current locals are the same as the locals in the previous frame, except that the last 1-3 locals are absent and with the empty stack (numLocal is 1, 2 or 3).
    • Opcodes#F_FULL representing complete frame data.

In both cases the first frame, corresponding to the method's parameters and access flags, is implicit and must not be visited. Also, it is illegal to visit two or more frames for the same code location (i.e., at least one instruction must be visited between two calls to visitFrame).
Parameters
type:int

the type of this stack map frame. Must be Opcodes#F_NEW for expanded frames, or Opcodes#F_FULL, Opcodes#F_APPEND, Opcodes#F_CHOP, Opcodes#F_SAME or Opcodes#F_APPEND, Opcodes#F_SAME1 for compressed frames.

localVariableLength:int

the number of local variables in the visited frame. Long and double values count for one variable.

localVariable:Object[]

the local variable types in this frame. This array must not be modified. Primitive types are represented by Opcodes#TOP, Opcodes#INTEGER, Opcodes#FLOAT, Opcodes#LONG, Opcodes#DOUBLE, Opcodes#NULL or Opcodes#UNINITIALIZED_THIS (long and double are represented by a single element). Reference types are represented by String objects (representing internal names, see Type#getInternalName()), and uninitialized types by Label objects (this label designates the NEW instruction that created this uninitialized value).

stackSize:int

the number of operand stack elements in the visited frame. Long and double values count for one stack element.

stack:Object[]

the operand stack types in this frame. This array must not be modified. Its content has the same format as the "local" array.

Annotations
@Override
@SuppressFBWarnings:RC_REF_COMPARISON_BAD_PRACTICE
justification:ASM models frames by reference identity.
visitInsnback to summary
public void visitInsn(int opcode)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitInsn.

Visits a zero operand instruction.

Parameters
opcode:int

the opcode of the instruction to be visited. This opcode is either NOP, ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT.

Annotations
@Override
visitIntInsnback to summary
public void visitIntInsn(int opcode, int operand)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitIntInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitIntInsn.

Visits an instruction with a single int operand.

Parameters
opcode:int

the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH or NEWARRAY.

operand:int

the operand of the instruction to be visited.
When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE.
When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE.
When opcode is NEWARRAY, operand value should be one of Opcodes#T_BOOLEAN, Opcodes#T_CHAR, Opcodes#T_FLOAT, Opcodes#T_DOUBLE, Opcodes#T_BYTE, Opcodes#T_SHORT, Opcodes#T_INT or Opcodes#T_LONG.

Annotations
@Override
visitInvokeDynamicInsnback to summary
public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootstrap, Object... bootstrapArguments)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitInvokeDynamicInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitInvokeDynamicInsn.

Visits an invokedynamic instruction.

Parameters
name:String

the method's name.

descriptor:String

the method's descriptor (see Type).

bootstrap:Handle

the bootstrap method.

bootstrapArguments:Object[]

the bootstrap method constant arguments. Each argument must be an Integer, Float, Long, Double, String, Type, Handle or ConstantDynamic value. This method is allowed to modify the content of the array so a caller should expect that this array may change.

Annotations
@Override
visitJumpInsnback to summary
public void visitJumpInsn(int opcode, Label label)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitJumpInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitJumpInsn.

Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.

Parameters
opcode:int

the opcode of the type instruction to be visited. This opcode is either IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.

label:Label

the operand of the instruction to be visited. This operand is a label that designates the instruction to which the jump instruction may jump.

Annotations
@Override
visitLabelback to summary
public void visitLabel(Label label)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLabel.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitLabel.

Visits a label. A label designates the instruction that will be visited just after it.

Parameters
label:Label

a Label object.

Annotations
@Override
visitLdcInsnback to summary
public void visitLdcInsn(Object value)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLdcInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitLdcInsn.

Visits a LDC instruction. Note that new constant types may be added in future versions of the Java Virtual Machine. To easily detect new constant types, implementations of this method should check for unexpected constant types, like this:

if (cst instanceof Integer) {
    // ...
} else if (cst instanceof Float) {
    // ...
} else if (cst instanceof Long) {
    // ...
} else if (cst instanceof Double) {
    // ...
} else if (cst instanceof String) {
    // ...
} else if (cst instanceof Type) {
    int sort = ((Type) cst).getSort();
    if (sort == Type.OBJECT) {
        // ...
    } else if (sort == Type.ARRAY) {
        // ...
    } else if (sort == Type.METHOD) {
        // ...
    } else {
        // throw an exception
    }
} else if (cst instanceof Handle) {
    // ...
} else if (cst instanceof ConstantDynamic) {
    // ...
} else {
    // throw an exception
}
Parameters
value:Object

the constant to be loaded on the stack. This parameter must be a non null Integer, a Float, a Long, a Double, a String, a Type of OBJECT or ARRAY sort for .class constants, for classes whose version is 49, a Type of METHOD sort for MethodType, a Handle for MethodHandle constants, for classes whose version is 51 or a ConstantDynamic for a constant dynamic for classes whose version is 55.

Annotations
@Override
visitLineNumberback to summary
public void visitLineNumber(int line, Label start)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLineNumber.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitLineNumber.

Visits a line number declaration.

Parameters
line:int

a line number. This number refers to the source file from which the class was compiled.

start:Label

the first instruction corresponding to this line number.

Annotations
@Override
visitLookupSwitchInsnback to summary
public void visitLookupSwitchInsn(Label defaultOption, int[] key, Label[] option)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitLookupSwitchInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitLookupSwitchInsn.

Visits a LOOKUPSWITCH instruction.

Parameters
defaultOption:Label

beginning of the default handler block.

key:int[]

the values of the keys.

option:Label[]

beginnings of the handler blocks. labels[i] is the beginning of the handler block for the keys[i] key.

Annotations
@Override
visitMethodInsnback to summary
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitMethodInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitMethodInsn.

Visits a method instruction. A method instruction is an instruction that invokes a method.

Parameters
opcode:int

the opcode of the type instruction to be visited. This opcode is either INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.

owner:String

the internal name of the method's owner class (see Type#getInternalName()).

name:String

the method's name.

descriptor:String

the method's descriptor (see Type).

isInterface:boolean

if the method's owner class is an interface.

Annotations
@Override
visitMultiANewArrayInsnback to summary
public void visitMultiANewArrayInsn(String descriptor, int dimension)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitMultiANewArrayInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitMultiANewArrayInsn.

Visits a MULTIANEWARRAY instruction.

Parameters
descriptor:String

an array type descriptor (see Type).

dimension:int

the number of dimensions of the array to allocate.

Annotations
@Override
visitTableSwitchInsnback to summary
public void visitTableSwitchInsn(int minimum, int maximum, Label defaultOption, Label... option)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTableSwitchInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitTableSwitchInsn.

Visits a TABLESWITCH instruction.

Parameters
minimum:int

the minimum key value.

maximum:int

the maximum key value.

defaultOption:Label

beginning of the default handler block.

option:Label[]

beginnings of the handler blocks. labels[i] is the beginning of the handler block for the min + i key.

Annotations
@Override
visitTryCatchBlockback to summary
public void visitTryCatchBlock(Label start, Label end, Label handler, String type)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTryCatchBlock.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitTryCatchBlock.

Visits a try catch block.

Parameters
start:Label

the beginning of the exception handler's scope (inclusive).

end:Label

the end of the exception handler's scope (exclusive).

handler:Label

the beginning of the exception handler's code.

type:String

the internal name of the type of exceptions handled by the handler (see Type#getInternalName()), or null to catch any exceptions (for "finally" blocks).

Annotations
@Override
visitTypeInsnback to summary
public void visitTypeInsn(int opcode, String type)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitTypeInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitTypeInsn.

Visits a type instruction. A type instruction is an instruction that takes the internal name of a class as parameter (see Type#getInternalName()).

Parameters
opcode:int

the opcode of the type instruction to be visited. This opcode is either NEW, ANEWARRAY, CHECKCAST or INSTANCEOF.

type:String

the operand of the instruction to be visited. This operand must be the internal name of an object or array class (see Type#getInternalName()).

Annotations
@Override
visitVarInsnback to summary
public void visitVarInsn(int opcode, int variable)

Overrides net.bytebuddy.jar.asm.MethodVisitor.visitVarInsn.

Doc from net.bytebuddy.jar.asm.MethodVisitor.visitVarInsn.

Visits a local variable instruction. A local variable instruction is an instruction that loads or stores the value of a local variable.

Parameters
opcode:int

the opcode of the local variable instruction to be visited. This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.

variable:int

the operand of the instruction to be visited. This operand is the index of a local variable.

Annotations
@Override
@SuppressFBWarnings:SF_SWITCH_NO_DEFAULT
justification:No action required on default option.