Package Summary Overview Summary

Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface LineNumberTableAttribute

All Superinterfaces:
  `AttributePREVIEW<LineNumberTableAttributePREVIEW>`, `ClassFileElementPREVIEW`, `WritableElementPREVIEW<LineNumberTableAttributePREVIEW>`

public sealed interface LineNumberTableAttribute extends AttributePREVIEW<LineNumberTableAttributePREVIEW>
`LineNumberTableAttribute` is a preview API of the Java platform.
Programs can only use `LineNumberTableAttribute` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the `LineNumberTable` attribute 4.7.12, which can appear on a `Code` attribute, and records the mapping between indexes into the code table and line numbers in the source file. Delivered as a `LineNumber`PREVIEW when traversing the elements of a `CodeModel`PREVIEW, according to the setting of the `ClassFile.LineNumbersOption`PREVIEW option.

The attribute permits multiple instances in a given location.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List <LineNumberInfoPREVIEW>`
  `lineNumbers()`
  Returns the table mapping bytecode offsets to source line numbers.
  `static LineNumberTableAttributePREVIEW`
  `of (List<LineNumberInfoPREVIEW> lines)`
  Returns a `LineNumberTable` attribute.

  ### Methods declared in interface java.lang.classfile.AttributePREVIEW

  `attributeMapper, attributeName`

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### lineNumbers

    List<LineNumberInfoPREVIEW> lineNumbers()
    Returns the table mapping bytecode offsets to source line numbers.
    Returns:
      the table mapping bytecode offsets to source line numbers

  - ### of

    static LineNumberTableAttributePREVIEW of (List<LineNumberInfoPREVIEW> lines)
    Returns a `LineNumberTable` attribute.
    Parameters:
      `lines` - the line number descriptions
    Returns:
      a `LineNumberTable` attribute