Package Summary Overview Summary

Module java.base
Package java.lang.classfile.instructionPREVIEW

# Interface LocalVariable

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `PseudoInstructionPREVIEW`

public sealed interface LocalVariable extends PseudoInstructionPREVIEW
`LocalVariable` is a preview API of the Java platform.
Programs can only use `LocalVariable` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A pseudo-instruction which models a single entry in the `LocalVariableTableAttribute`PREVIEW. Delivered as a `CodeElement`PREVIEW during traversal of the elements of a `CodeModel`PREVIEW, according to the setting of the `ClassFile.DebugElementsOption`PREVIEW option.

Since:
  22
See Also:
  - `PseudoInstruction`PREVIEW

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LabelPREVIEW`
  `endScope()`
  Returns the end range of the local variable scope.
  `Utf8EntryPREVIEW`
  `name()`
  Returns the local variable name.
  `static LocalVariablePREVIEW`
  `of (int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW descriptorEntry, LabelPREVIEW startScope, LabelPREVIEW endScope)`
  Returns a local variable pseudo-instruction.
  `static LocalVariablePREVIEW`
  `of (int slot, String name, ClassDesc descriptor, LabelPREVIEW startScope, LabelPREVIEW endScope)`
  Returns a local variable pseudo-instruction.
  `int`
  `slot()`
  Returns the local variable slot.
  `LabelPREVIEW`
  `startScope()`
  Returns the start range of the local variable scope.
  `Utf8EntryPREVIEW`
  `type()`
  Returns the local variable field descriptor.
  `default ClassDesc`
  `typeSymbol()`
  Returns the local variable type, as a symbolic descriptor.
  `boolean`
  `writeTo (BufWriterPREVIEW buf)`
  Writes the local variable to the specified writer

- ## Method Details

  - ### slot

    int slot()
    Returns the local variable slot.
    Returns:
      the local variable slot

  - ### name

    Utf8EntryPREVIEW name()
    Returns the local variable name.
    Returns:
      the local variable name

  - ### type

    Utf8EntryPREVIEW type()
    Returns the local variable field descriptor.
    Returns:
      the local variable field descriptor

  - ### typeSymbol

    default ClassDesc typeSymbol()
    Returns the local variable type, as a symbolic descriptor.
    Returns:
      the local variable type, as a symbolic descriptor

  - ### startScope

    LabelPREVIEW startScope()
    Returns the start range of the local variable scope.
    Returns:
      the start range of the local variable scope

  - ### endScope

    LabelPREVIEW endScope()
    Returns the end range of the local variable scope.
    Returns:
      the end range of the local variable scope

  - ### writeTo

    boolean writeTo (BufWriterPREVIEW buf)
    Writes the local variable to the specified writer
    Parameters:
      `buf` - the writer
    Returns:
      true if the variable has been written

  - ### of

    static LocalVariablePREVIEW of (int slot, Utf8EntryPREVIEW nameEntry, Utf8EntryPREVIEW descriptorEntry, LabelPREVIEW startScope, LabelPREVIEW endScope)
    Returns a local variable pseudo-instruction.
    Parameters:
      `slot` - the local variable slot
      `nameEntry` - the local variable name
      `descriptorEntry` - the local variable descriptor
      `startScope` - the start range of the local variable scope
      `endScope` - the end range of the local variable scope
    Returns:
      a local variable pseudo-instruction

  - ### of

    static LocalVariablePREVIEW of (int slot, String name, ClassDesc descriptor, LabelPREVIEW startScope, LabelPREVIEW endScope)
    Returns a local variable pseudo-instruction.
    Parameters:
      `slot` - the local variable slot
      `name` - the local variable name
      `descriptor` - the local variable descriptor
      `startScope` - the start range of the local variable scope
      `endScope` - the end range of the local variable scope
    Returns:
      a local variable pseudo-instruction