ConstantInstruction.ArgumentConstantInstruction (Java SE 25 & JDK 25)
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`

- ## 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`

- ## 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