DiscontinuedInstruction.JsrInstruction (Java SE 23 & JDK 23)
Description: declaration: module: java.base, package: java.lang.classfile.instruction, interface: DiscontinuedInstruction, interface: JsrInstruction
Keywords: java.lang.classfile.instruction.DiscontinuedInstruction.JsrInstruction interface

# Interface DiscontinuedInstruction.JsrInstruction

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

Enclosing interface:
  `DiscontinuedInstructionPREVIEW`

public static sealed interface DiscontinuedInstruction.JsrInstruction extends DiscontinuedInstructionPREVIEW
`JsrInstruction` is a preview API of the Java platform.
Programs can only use `JsrInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models JSR and JSR_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_JSR`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.JsrInstructionPREVIEW`
  `of(LabelPREVIEW target)`
  Returns a JSR instruction.
  `static DiscontinuedInstruction.JsrInstructionPREVIEW`
  `of(OpcodePREVIEW op, LabelPREVIEW target)`
  Returns a JSR instruction.
  `LabelPREVIEW`
  `target()`
  Returns the target of the JSR instruction.

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

  `opcode, sizeInBytes`

- ## Method Details

  - ### target

    LabelPREVIEW target()
    Returns the target of the JSR instruction.
    Returns:
      the target of the JSR instruction

  - ### of

    static DiscontinuedInstruction.JsrInstructionPREVIEW of(OpcodePREVIEW op, LabelPREVIEW target)
    Returns a JSR instruction.
    Parameters:
      `op` - the opcode for the specific type of JSR instruction, which must be of kind `Opcode.Kind.DISCONTINUED_JSR`PREVIEW
      `target` - target label of the subroutine
    Returns:
      a JSR instruction
    Throws:
      `IllegalArgumentException` - if the opcode kind is not `Opcode.Kind.DISCONTINUED_JSR`PREVIEW.

  - ### of

    static DiscontinuedInstruction.JsrInstructionPREVIEW of(LabelPREVIEW target)
    Returns a JSR instruction.
    Parameters:
      `target` - target label of the subroutine
    Returns:
      a JSR instruction