Instruction (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile, interface: Instruction
Keywords: java.lang.classfile.Instruction interface

Module java.base
Package java.lang.classfilePREVIEW

# Interface Instruction

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`

All Known Subinterfaces:
  `ArrayLoadInstructionPREVIEW`, `ArrayStoreInstructionPREVIEW`, `BranchInstructionPREVIEW`, `ConstantInstructionPREVIEW`, `ConstantInstruction.ArgumentConstantInstructionPREVIEW`, `ConstantInstruction.IntrinsicConstantInstructionPREVIEW`, `ConstantInstruction.LoadConstantInstructionPREVIEW`, `ConvertInstructionPREVIEW`, `DiscontinuedInstructionPREVIEW`, `DiscontinuedInstruction.JsrInstructionPREVIEW`, `DiscontinuedInstruction.RetInstructionPREVIEW`, `FieldInstructionPREVIEW`, `IncrementInstructionPREVIEW`, `InvokeDynamicInstructionPREVIEW`, `InvokeInstructionPREVIEW`, `LoadInstructionPREVIEW`, `LookupSwitchInstructionPREVIEW`, `MonitorInstructionPREVIEW`, `NewMultiArrayInstructionPREVIEW`, `NewObjectInstructionPREVIEW`, `NewPrimitiveArrayInstructionPREVIEW`, `NewReferenceArrayInstructionPREVIEW`, `NopInstructionPREVIEW`, `OperatorInstructionPREVIEW`, `ReturnInstructionPREVIEW`, `StackInstructionPREVIEW`, `StoreInstructionPREVIEW`, `TableSwitchInstructionPREVIEW`, `ThrowInstructionPREVIEW`, `TypeCheckInstructionPREVIEW`

public sealed interface Instruction extends CodeElementPREVIEW permits ArrayLoadInstructionPREVIEW, ArrayStoreInstructionPREVIEW, BranchInstructionPREVIEW, ConstantInstructionPREVIEW, ConvertInstructionPREVIEW, DiscontinuedInstructionPREVIEW, FieldInstructionPREVIEW, InvokeDynamicInstructionPREVIEW, InvokeInstructionPREVIEW, LoadInstructionPREVIEW, StoreInstructionPREVIEW, IncrementInstructionPREVIEW, LookupSwitchInstructionPREVIEW, MonitorInstructionPREVIEW, NewMultiArrayInstructionPREVIEW, NewObjectInstructionPREVIEW, NewPrimitiveArrayInstructionPREVIEW, NewReferenceArrayInstructionPREVIEW, NopInstructionPREVIEW, OperatorInstructionPREVIEW, ReturnInstructionPREVIEW, StackInstructionPREVIEW, TableSwitchInstructionPREVIEW, ThrowInstructionPREVIEW, TypeCheckInstructionPREVIEW (not exhaustive)
`Instruction` is a preview API of the Java platform.
Programs can only use `Instruction` 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 executable instruction in a method body.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OpcodePREVIEW`
  `opcode()`
  Returns the opcode of this instruction.
  `int`
  `sizeInBytes()`
  Returns the size in bytes of this instruction.

- ## Method Details

  - ### opcode

    OpcodePREVIEW opcode()
    Returns the opcode of this instruction.
    Returns:
      the opcode of this instruction

  - ### sizeInBytes

    int sizeInBytes()
    Returns the size in bytes of this instruction.
    Returns:
      the size in bytes of this instruction