Interface ConvertInstruction
- All Superinterfaces:
ClassFileElement,CodeElement,Instruction
Models a primitive conversion instruction in the
where these conversions are valid:
code array of a
Code attribute, such as i2l. Corresponding opcodes
have a kind of Opcode.Kind.CONVERT.
Delivered as a CodeElement when traversing the elements of a CodeModel.
A primitive conversion instruction is composite:
ConvertInstruction(
TypeKind fromType,
TypeKind toType
)
- Between
int,long,float, anddouble, wherefromType != toType; - From
inttobyte,char, andshort.
- Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfromType()Returns the source type to convert from.static ConvertInstructionReturns a conversion instruction.static ConvertInstructionReturns a conversion instruction.toType()Returns the destination type to convert to.Methods declared in interface java.lang.classfile.Instruction
opcode, sizeInBytes
-
Method Details
-
fromType
TypeKind fromType()Returns the source type to convert from.- Returns:
- the source type to convert from
-
toType
TypeKind toType()Returns the destination type to convert to.- Returns:
- the destination type to convert to
-
of
Returns a conversion instruction. Valid conversions are:- Between
int,long,float, anddouble, wherefromType != toType; - From
inttobyte,char, andshort.
- Parameters:
fromType- the type to convert fromtoType- the type to convert to- Returns:
- a conversion instruction
- Throws:
IllegalArgumentException- if this is not a valid conversion
- Between
-
of
Returns a conversion instruction.- Parameters:
op- the opcode for the specific type of conversion instruction, which must be of kindOpcode.Kind.CONVERT- Returns:
- a conversion instruction
- Throws:
IllegalArgumentException- if the opcode kind is notOpcode.Kind.CONVERT.
-