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

# Interface ConstantInstruction.ArgumentConstantInstruction

All Superinterfaces:
  `ClassFileElement, CodeElement, ConstantInstruction, Instruction`

Enclosing interface:
  `ConstantInstruction`

public static sealed interface ConstantInstruction.ArgumentConstantInstruction extends ConstantInstruction
Models an "argument constant" instruction, which encodes the constant value in the instruction directly. Includes `bipush` and `sipush` instructions.

An argument constant instruction is composite:

    ArgumentConstantInstruction(
        Opcode opcode,
        int constantValue
    )

where:

- `opcode` must be one of `bipush` or `sipush`.
- `constantValue` must be in the range of `byte`, `[-128, 127]`, for `bipush`, and in the range of `short`, `[-32768, 32767]`, for `sipush`.

Since:
  24
See Also:
  - `Opcode.Kind.CONSTANT`
  - `ConstantInstruction::ofArgument`
  - `CodeBuilder::loadConstant(int)`
  - `CodeBuilder::bipush`
  - `CodeBuilder::sipush`

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface ConstantInstruction

  `ConstantInstruction.ArgumentConstantInstruction, ConstantInstruction.IntrinsicConstantInstruction, ConstantInstruction.LoadConstantInstruction`
  Modifier and Type
  Interface
  Description
  `static interface`
  `ConstantInstruction.ArgumentConstantInstruction`
  Models an "argument constant" instruction, which encodes the constant value in the instruction directly.
  `static interface`
  `ConstantInstruction.IntrinsicConstantInstruction`
  Models an "intrinsic constant" instruction, which encodes the constant value in its opcode.
  `static interface`
  `ConstantInstruction.LoadConstantInstruction`
  Models a "load constant" instruction, which encodes the constant value in the constant pool.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Integer`
  `constantValue()`
  Returns the constant value.
  `default TypeKind`
  `typeKind()`
  Returns the computational type of the constant.

  ### Methods declared in interface Instruction

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

- ## Method Details

  - ### constantValue

    Integer constantValue()
    Description copied from interface: `ConstantInstruction`
    Returns the constant value.
    Specified by:
      `constantValue` in interface `ConstantInstruction`
    Returns:
      the constant value

  - ### typeKind

    default TypeKind typeKind()
    Description copied from interface: `ConstantInstruction`
    Returns the computational type of the constant. This is derived from the `constantValue`.
    Specified by:
      `typeKind` in interface `ConstantInstruction`
    Returns:
      the computational type of the constant