Top Description Methods
java.lang.classfile.instruction

public sealed Interface ConvertInstruction

extends Instruction
Known Direct Implementers
jdk.internal.classfile.impl.AbstractInstruction.UnboundConvertInstruction
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.classfile.CodeElement, .CodeModel, .Instruction, .Opcode, .TypeKind, jdk.internal.classfile.impl.AbstractInstruction, .BytecodeHelpers, .Util, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use ConvertInstruction when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

Models a primitive conversion instruction in the code array of a Code attribute, such as i2l. Corresponding opcodes will have a kind of Opcode.Kind#CONVERT. Delivered as a CodeElement when traversing the elements of a CodeModel.
Since
22

Method Summary

Modifier and TypeMethod and Description
public TypeKind

Returns:

the source type to convert from
fromType
()

Returns the source type to convert from.

public static ConvertInstruction

Returns:

A conversion instruction
of
(TypeKind
the type to convert from
fromType
,
TypeKind
the type to convert to
toType
)

Returns A conversion instruction.

public static ConvertInstruction

Returns:

a conversion instruction
of
(Opcode
the opcode for the specific type of conversion instruction, which must be of kind Opcode.Kind#CONVERT
op
)

Returns a conversion instruction.

public TypeKind

Returns:

the destination type to convert to
toType
()

Returns the destination type to convert to.

Inherited from java.lang.classfile.Instruction:
opcodesizeInBytes

Method Detail

fromTypeback to summary
public TypeKind fromType()

Returns the source type to convert from.

Returns:TypeKind

the source type to convert from

ofback to summary
public static ConvertInstruction of(TypeKind fromType, TypeKind toType)

Returns A conversion instruction.

Parameters
fromType:TypeKind

the type to convert from

toType:TypeKind

the type to convert to

Returns:ConvertInstruction

A conversion instruction

ofback to summary
public static ConvertInstruction of(Opcode op)

Returns a conversion instruction.

Parameters
op:Opcode

the opcode for the specific type of conversion instruction, which must be of kind Opcode.Kind#CONVERT

Returns:ConvertInstruction

a conversion instruction

Exceptions
IllegalArgumentException:
if the opcode kind is not Opcode.Kind#CONVERT.
toTypeback to summary
public TypeKind toType()

Returns the destination type to convert to.

Returns:TypeKind

the destination type to convert to