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

# Interface OperatorInstruction

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

public sealed interface OperatorInstruction extends InstructionPREVIEW
`OperatorInstruction` is a preview API of the Java platform.
Programs can only use `OperatorInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an arithmetic operator instruction in the `code` array of a `Code` attribute. Corresponding opcodes will have a `kind` of `Opcode.Kind.OPERATOR`PREVIEW. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OperatorInstructionPREVIEW`
  `of(OpcodePREVIEW op)`
  Returns an operator instruction.
  `TypeKindPREVIEW`
  `typeKind()`
  Returns the operand type of the instruction.

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

  `opcode, sizeInBytes`

- ## Method Details

  - ### typeKind

    TypeKindPREVIEW typeKind()
    Returns the operand type of the instruction.
    Returns:
      the operand type of the instruction

  - ### of

    static OperatorInstructionPREVIEW of(OpcodePREVIEW op)
    Returns an operator instruction.
    Parameters:
      `op` - the opcode for the specific type of array load instruction, which must be of kind `Opcode.Kind.OPERATOR`PREVIEW
    Returns:
      an operator instruction
    Throws:
      `IllegalArgumentException` - if the opcode kind is not `Opcode.Kind.OPERATOR`PREVIEW.