Package Summary Overview Summary

Module java.base
Package java.lang.classfile.instructionPREVIEW

# Interface DiscontinuedInstruction.RetInstruction

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `DiscontinuedInstructionPREVIEW`, `InstructionPREVIEW`

Enclosing interface:
  `DiscontinuedInstructionPREVIEW`

public static sealed interface DiscontinuedInstruction.RetInstruction extends DiscontinuedInstructionPREVIEW
`RetInstruction` is a preview API of the Java platform.
Programs can only use `RetInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models RET and RET_W instructions discontinued from the `code` array of a `Code` attribute since class file version 51.0. Corresponding opcodes will have a `kind` of `Opcode.Kind.DISCONTINUED_RET`PREVIEW. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Nested Class Summary

  ## Nested classes/interfaces declared in interface java.lang.classfile.instruction.DiscontinuedInstructionPREVIEW

  `DiscontinuedInstruction.JsrInstructionPREVIEW, DiscontinuedInstruction.RetInstructionPREVIEW`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static DiscontinuedInstruction.RetInstructionPREVIEW`
  `of (int slot)`
  Returns a RET instruction.
  `static DiscontinuedInstruction.RetInstructionPREVIEW`
  `of (OpcodePREVIEW op, int slot)`
  Returns a RET or RET_W instruction.
  `int`
  `slot()`
  Returns the local variable slot with return address.

  ### Methods declared in interface java.lang.classfile.InstructionPREVIEW

  `opcode, sizeInBytes`

- ## Method Details

  - ### slot

    int slot()
    Returns the local variable slot with return address.
    Returns:
      the local variable slot with return address

  - ### of

    static DiscontinuedInstruction.RetInstructionPREVIEW of (OpcodePREVIEW op, int slot)
    Returns a RET or RET_W instruction.
    Parameters:
      `op` - the opcode for the specific type of RET instruction, which must be of kind `Opcode.Kind.DISCONTINUED_RET`PREVIEW
      `slot` - the local variable slot to load return address from
    Returns:
      a RET or RET_W instruction

  - ### of

    static DiscontinuedInstruction.RetInstructionPREVIEW of (int slot)
    Returns a RET instruction.
    Parameters:
      `slot` - the local variable slot to load return address from
    Returns:
      a RET instruction