Top Description Fields Constructors Methods
org.objectweb.asm.tree.analysis

public Class BasicVerifier

extends BasicInterpreter
Class Inheritance
Known Direct Subclasses
org.objectweb.asm.tree.analysis.SimpleVerifier
Imports
java.util.List, org.objectweb.asm.Opcodes, .Type, org.objectweb.asm.tree.AbstractInsnNode, .FieldInsnNode, .InvokeDynamicInsnNode, .MethodInsnNode

An extended BasicInterpreter that checks that bytecode instructions are correctly used.
Authors
Eric Bruneton, Bing Ran

Field Summary

Inherited from org.objectweb.asm.tree.analysis.BasicInterpreter:
NULL_TYPE

Constructor Summary

AccessConstructor and Description
public
BasicVerifier()

Constructs a new BasicVerifier for the latest ASM API version.

protected
BasicVerifier(final int
the ASM API version supported by this interpreter. Must be one of the ASMx values in Opcodes.
api
)

Constructs a new BasicVerifier.

Method Summary

Modifier and TypeMethod and Description
public BasicValue
binaryOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final BasicValue
the first argument of the instruction to be interpreted.
value1
,
final BasicValue
the second argument of the instruction to be interpreted.
value2
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.binaryOperation.

Interprets a bytecode instruction with two arguments.
public BasicValue
copyOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final BasicValue
the value that must be moved by the instruction.
value
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.copyOperation.

Interprets a bytecode instruction that moves a value on the stack or to or from local variables.
protected BasicValue

Returns:

the value corresponding to the type of the elements of 'objectArrayValue'.
getElementValue
(final BasicValue
a value corresponding to array of object (or array) references.
objectArrayValue
)

Returns the value corresponding to the type of the elements of the given array reference value.

protected boolean

Returns:

whether 'value' corresponds to an array reference.
isArrayValue
(final BasicValue
a value.
value
)

Returns whether the given value corresponds to an array reference.

protected boolean

Returns:

whether the type corresponding to 'value' is a subtype of the type corresponding to 'expected'.
isSubTypeOf
(final BasicValue
a value.
value
,
final BasicValue
another value.
expected
)

Returns whether the type corresponding to the first argument is a subtype of the type corresponding to the second argument.

public BasicValue
naryOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final List<? extends BasicValue>
the arguments of the instruction to be interpreted.
values
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.naryOperation.

Interprets a bytecode instruction with a variable number of arguments.
public void
returnOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final BasicValue
the argument of the instruction to be interpreted.
value
,
final BasicValue
the expected return type of the analyzed method.
expected
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.returnOperation.

Interprets a bytecode return instruction.
public BasicValue
ternaryOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final BasicValue
the first argument of the instruction to be interpreted.
value1
,
final BasicValue
the second argument of the instruction to be interpreted.
value2
,
final BasicValue
the third argument of the instruction to be interpreted.
value3
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.ternaryOperation.

Interprets a bytecode instruction with three arguments.
public BasicValue
unaryOperation(final AbstractInsnNode
the bytecode instruction to be interpreted.
insn
,
final BasicValue
the argument of the instruction to be interpreted.
value
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.unaryOperation.

Interprets a bytecode instruction with a single argument.
Inherited from org.objectweb.asm.tree.analysis.BasicInterpreter:
mergenewOperationnewValue

Constructor Detail

BasicVerifierback to summary
public BasicVerifier()

Constructs a new BasicVerifier for the latest ASM API version. Subclasses must not use this constructor. Instead, they must use the BasicVerifier(int) version.

BasicVerifierback to summary
protected BasicVerifier(final int api)

Constructs a new BasicVerifier.

Parameters
api:int

the ASM API version supported by this interpreter. Must be one of the ASMx values in Opcodes.

Method Detail

binaryOperationback to summary
public BasicValue binaryOperation(final AbstractInsnNode insn, final BasicValue value1, final BasicValue value2) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.binaryOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.binaryOperation.

Interprets a bytecode instruction with two arguments. This method is called for the following opcodes:

IALOAD, LALOAD, FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV, FDIV, DDIV, IREM, LREM, FREM, DREM, ISHL, LSHL, ISHR, LSHR, IUSHR, LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, PUTFIELD

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

value1:BasicValue

the first argument of the instruction to be interpreted.

value2:BasicValue

the second argument of the instruction to be interpreted.

Returns:BasicValue

the result of the interpretation of the given instruction.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.
copyOperationback to summary
public BasicValue copyOperation(final AbstractInsnNode insn, final BasicValue value) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.copyOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.copyOperation.

Interprets a bytecode instruction that moves a value on the stack or to or from local variables. This method is called for the following opcodes:

ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, SWAP

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

value:BasicValue

the value that must be moved by the instruction.

Returns:BasicValue

the result of the interpretation of the given instruction. The returned value must be equal to the given value.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.
getElementValueback to summary
protected BasicValue getElementValue(final BasicValue objectArrayValue) throws AnalyzerException

Returns the value corresponding to the type of the elements of the given array reference value.

Parameters
objectArrayValue:BasicValue

a value corresponding to array of object (or array) references.

Returns:BasicValue

the value corresponding to the type of the elements of 'objectArrayValue'.

Exceptions
AnalyzerException:
if objectArrayValue does not correspond to an array type.
isArrayValueback to summary
protected boolean isArrayValue(final BasicValue value)

Returns whether the given value corresponds to an array reference.

Parameters
value:BasicValue

a value.

Returns:boolean

whether 'value' corresponds to an array reference.

isSubTypeOfback to summary
protected boolean isSubTypeOf(final BasicValue value, final BasicValue expected)

Returns whether the type corresponding to the first argument is a subtype of the type corresponding to the second argument.

Parameters
value:BasicValue

a value.

expected:BasicValue

another value.

Returns:boolean

whether the type corresponding to 'value' is a subtype of the type corresponding to 'expected'.

naryOperationback to summary
public BasicValue naryOperation(final AbstractInsnNode insn, final List<? extends BasicValue> values) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.naryOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.naryOperation.

Interprets a bytecode instruction with a variable number of arguments. This method is called for the following opcodes:

INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE, MULTIANEWARRAY and INVOKEDYNAMIC

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

values:List<? extends BasicValue>

the arguments of the instruction to be interpreted.

Returns:BasicValue

the result of the interpretation of the given instruction.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.
returnOperationback to summary
public void returnOperation(final AbstractInsnNode insn, final BasicValue value, final BasicValue expected) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.returnOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.returnOperation.

Interprets a bytecode return instruction. This method is called for the following opcodes:

IRETURN, LRETURN, FRETURN, DRETURN, ARETURN

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

value:BasicValue

the argument of the instruction to be interpreted.

expected:BasicValue

the expected return type of the analyzed method.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.
ternaryOperationback to summary
public BasicValue ternaryOperation(final AbstractInsnNode insn, final BasicValue value1, final BasicValue value2, final BasicValue value3) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.ternaryOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.ternaryOperation.

Interprets a bytecode instruction with three arguments. This method is called for the following opcodes:

IASTORE, LASTORE, FASTORE, DASTORE, AASTORE, BASTORE, CASTORE, SASTORE

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

value1:BasicValue

the first argument of the instruction to be interpreted.

value2:BasicValue

the second argument of the instruction to be interpreted.

value3:BasicValue

the third argument of the instruction to be interpreted.

Returns:BasicValue

the result of the interpretation of the given instruction.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.
unaryOperationback to summary
public BasicValue unaryOperation(final AbstractInsnNode insn, final BasicValue value) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.unaryOperation.

Doc from org.objectweb.asm.tree.analysis.Interpreter.unaryOperation.

Interprets a bytecode instruction with a single argument. This method is called for the following opcodes:

INEG, LNEG, FNEG, DNEG, IINC, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I, D2L, D2F, I2B, I2C, I2S, IFEQ, IFNE, IFLT, IFGE, IFGT, IFLE, TABLESWITCH, LOOKUPSWITCH, IRETURN, LRETURN, FRETURN, DRETURN, ARETURN, PUTSTATIC, GETFIELD, NEWARRAY, ANEWARRAY, ARRAYLENGTH, ATHROW, CHECKCAST, INSTANCEOF, MONITORENTER, MONITOREXIT, IFNULL, IFNONNULL

Parameters
insn:AbstractInsnNode

the bytecode instruction to be interpreted.

value:BasicValue

the argument of the instruction to be interpreted.

Returns:BasicValue

the result of the interpretation of the given instruction.

Annotations
@Override
Exceptions
AnalyzerException:
if an error occurred during the interpretation.