Top Description Methods
java.lang.classfile.attribute

public sealed Interface LineNumberTableAttribute

extends Attribute<LineNumberTableAttribute>
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundLineNumberTableAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundLineNumberTableAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.util.List, java.lang.classfile.Attribute, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

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 java.lang.classfile.instruction.LineNumber when traversing the elements of a java.lang.classfile.CodeModel, according to the setting of the java.lang.classfile.ClassFile.LineNumbersOption option.

The attribute permits multiple instances in a given location.

Since
22

Method Summary

Modifier and TypeMethod and Description
public List<LineNumberInfo>

Returns:

the table mapping bytecode offsets to source line numbers
lineNumbers
()

Returns the table mapping bytecode offsets to source line numbers.

public static LineNumberTableAttribute

Returns:

a LineNumberTable attribute
of
(List<LineNumberInfo>
the line number descriptions
lines
)

Returns a LineNumberTable attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

lineNumbersback to summary
public List<LineNumberInfo> lineNumbers()

Returns the table mapping bytecode offsets to source line numbers.

Returns:List<LineNumberInfo>

the table mapping bytecode offsets to source line numbers

ofback to summary
public static LineNumberTableAttribute of(List<LineNumberInfo> lines)

Returns a LineNumberTable attribute.

Parameters
lines:List<LineNumberInfo>

the line number descriptions

Returns:LineNumberTableAttribute

a LineNumberTable attribute