APIdia Launch Partner
Top Description Methods
java.lang.classfile.instruction

public sealed Interface ReturnInstruction

extends Instruction
permits UnboundReturnInstruction
Known Direct Implementers
jdk.internal.classfile.impl.AbstractInstruction.UnboundReturnInstruction
Imports
java.lang.classfile.CodeBuilder, .CodeElement, .CodeModel, .Instruction, .Opcode, .TypeKind, jdk.internal.classfile.impl.AbstractInstruction, .BytecodeHelpers, .Util

Models a return-from-method instruction in the code array of a Code attribute. Corresponding opcodes have a kind of Opcode.Kind#RETURN. Delivered as a CodeElement when traversing the elements of a CodeModel.

A return-from-method instruction is composite:

ReturnInstruction(TypeKind typeKind)
ReturnInstruction(TypeKind typeKind)
where typeKind is computational or void.
Since
24
See Also
Opcode.Kind#RETURN, CodeBuilder::return_

Method Summary

Modifier and TypeMethod and Description
public static ReturnInstruction

Returns:

a return instruction
of
(TypeKind
the type of the return instruction
typeKind
)

Returns a return instruction.

public static ReturnInstruction

Returns:

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

Returns a return instruction.

public TypeKind

Returns:

the computational type, including void, of the return instruction
typeKind
()

Returns the computational type, including void, of the return instruction.

Inherited from java.lang.classfile.Instruction:
opcodesizeInBytes

Method Detail

ofback to summary
public static ReturnInstruction of(TypeKind typeKind)

Returns a return instruction. typeKind is converted to its computational type.

Parameters
typeKind:TypeKind

the type of the return instruction

Returns:ReturnInstruction

a return instruction

ofback to summary
public static ReturnInstruction of(Opcode op)

Returns a return instruction.

Parameters
op:Opcode

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

Returns:ReturnInstruction

a return instruction

Exceptions
IllegalArgumentException:
if the opcode kind is not Opcode.Kind#RETURN.
typeKindback to summary
public TypeKind typeKind()

Returns the computational type, including void, of the return instruction.

Returns:TypeKind

the computational type, including void, of the return instruction