instanceof or a checkcast
instruction in the code array of a Code attribute. Corresponding
opcodes have a kind of Opcode.Kind#TYPE_CHECK .
Delivered as a CodeElement when traversing the elements of a CodeModel.
An instanceof checks the type and pushes an integer to the operand stack.
A checkcast checks the type and throws a ClassCastException if
the check fails. instanceof treat the null reference as a
failure, while checkcast treat the null reference as a success.
A type check instruction is composite:
TypeCheckInstruction( Opcode opcode, ClassEntry type )
| Modifier and Type | Method and Description |
|---|---|
| public static TypeCheckInstruction | Returns: a type check instructionthe opcode for the specific type of type check instruction,
which must be of kind op, ClassEntry Opcode.the type against which to check or cast type)Returns a type check instruction. |
| public static TypeCheckInstruction | Returns: a type check instructionthe opcode for the specific type of type check instruction,
which must be of kind op, ClassDesc Opcode.the type against which to check or cast type)Returns a type check instruction. |
| public ClassEntry | Returns: the type against which the instruction checksReturns the type against which the instruction checks. |
| of | back to summary |
|---|---|
| public static TypeCheckInstruction of(Opcode op, ClassEntry type) Returns a type check instruction.
| |
| of | back to summary |
|---|---|
| public static TypeCheckInstruction of(Opcode op, ClassDesc type) Returns a type check instruction.
| |
| type | back to summary |
|---|---|
| public ClassEntry type() Returns the type against which the instruction checks.
| |