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

# Interface StackMapFrameInfo

public sealed interface StackMapFrameInfo
Models a stack map frame in a `StackMapTable` attribute (JVMS 4.7.4). A stack map frame must appear at the beginning of each basic block in a method (JVMS 4.10.1).

API Note:
  In general, a stack map frame should be defined for each target of a `BranchInstruction`, or unreachable code right after an unconditional branch instruction like `goto`. The automatic stack map generation cannot handle unreachable code right after an unconditional jump; The `ClassFile.DeadCodeOption` allows substituting such code, or advanced users can provide their own stack maps for dead code.
See Java Virtual Machine Specification:
  4.7.4 The `StackMapTable` Attribute
  4.10.1 Verification by Type Checking
Since:
  24
See Also:
  - `StackMapTableAttribute.entries()`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `StackMapFrameInfo.ObjectVerificationTypeInfo`
  A stack value for an object type.
  `static enum`
  `StackMapFrameInfo.SimpleVerificationTypeInfo`
  A simple stack value.
  `static interface`
  `StackMapFrameInfo.UninitializedVerificationTypeInfo`
  An uninitialized stack value.
  `static interface`
  `StackMapFrameInfo.VerificationTypeInfo`
  The type of a stack or local variable value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `frameType()`
  Returns the raw `u1 frame_type`.
  `List<StackMapFrameInfo.VerificationTypeInfo>`
  `locals()`
  Returns the expanded local variable types.
  `static StackMapFrameInfo`
  `of(Label target, List<StackMapFrameInfo.VerificationTypeInfo> locals, List<StackMapFrameInfo.VerificationTypeInfo> stack)`
  Returns a new stack map frame.
  `List<StackMapFrameInfo.VerificationTypeInfo>`
  `stack()`
  Returns the expanded operand stack types.
  `Label`
  `target()`
  Returns the frame target label.

- ## Method Details

  - ### frameType

    int frameType()
    Returns the raw `u1 frame_type`.
    Returns:
      the raw `u1 frame_type`

  - ### target

    Label target()
    Returns the frame target label.
    Returns:
      the frame target label

  - ### locals

    List<StackMapFrameInfo.VerificationTypeInfo> locals()
    Returns the expanded local variable types.
    Returns:
      the expanded local variable types

  - ### stack

    List<StackMapFrameInfo.VerificationTypeInfo> stack()
    Returns the expanded operand stack types.
    Returns:
      the expanded operand stack types

  - ### of

    static StackMapFrameInfo of(Label target, List<StackMapFrameInfo.VerificationTypeInfo> locals, List<StackMapFrameInfo.VerificationTypeInfo> stack)
    Returns a new stack map frame.
    Parameters:
      `target` - the location of the frame
      `locals` - the complete list of frame locals
      `stack` - the complete frame stack
    Returns:
      a new stack map frame
    Throws:
      `IllegalArgumentException` - if the number of types in `locals` or `stack` exceeds the limit of `u2`