Package Summary Overview Summary

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

# Interface BranchInstruction

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

public sealed interface BranchInstruction extends InstructionPREVIEW
`BranchInstruction` is a preview API of the Java platform.
Programs can only use `BranchInstruction` 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 branching instruction (conditional or unconditional) in the `code` array of a `Code` attribute. Corresponding opcodes will have a `kind` of `Opcode.Kind.BRANCH`PREVIEW. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static BranchInstructionPREVIEW`
  `of (OpcodePREVIEW op, LabelPREVIEW target)`
  Returns a branch instruction.
  `LabelPREVIEW`
  `target()`
  Returns the target of the branch.

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

  `opcode, sizeInBytes`

- ## Method Details

  - ### target

    LabelPREVIEW target()
    Returns the target of the branch.
    Returns:
      the target of the branch

  - ### of

    static BranchInstructionPREVIEW of (OpcodePREVIEW op, LabelPREVIEW target)
    Returns a branch instruction.
    Parameters:
      `op` - the opcode for the specific type of branch instruction, which must be of kind `Opcode.Kind.BRANCH`PREVIEW
      `target` - the target of the branch
    Returns:
      a branch instruction