APIdia Launch Partner
Top Description Methods
java.lang.classfile.instruction

public sealed Interface LineNumber

extends PseudoInstruction
permits LineNumberImpl
Known Direct Implementers
jdk.internal.classfile.impl.LineNumberImpl
Imports
java.lang.classfile.ClassFile, .CodeBuilder, .CodeElement, .CodeModel, .PseudoInstruction, java.lang.classfile.attribute.CodeAttribute, .LineNumberInfo, .LineNumberTableAttribute, jdk.internal.classfile.impl.LineNumberImpl

A pseudo-instruction which indicates the code for a given line number starts after the current position in a Code attribute. This models a single entry in the LineNumberTable attribute. Delivered as a CodeElement during traversal of the elements of a CodeModel, according to the setting of the ClassFile.LineNumbersOption option.

A line number entry is composite:

LineNumber(int line)
LineNumber(int line)

Another model, LineNumberInfo, also models a line number entry; it has no dependency on a CodeModel and represents of bci values as ints instead of order of pseudo-instructions in the elements of a CodeModel, and is used as components of a LineNumberTableAttribute.

API Note

Line numbers are represented with custom pseudo-instructions to avoid using labels, which usually indicate branching targets for the control flow.

Since
24
See Also
LineNumberInfo, CodeBuilder::lineNumber, ClassFile.LineNumbersOption

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the line number
line
()

Returns the line number.

public static LineNumber

Returns:

a line number pseudo-instruction
of
(int
the line number
line
)

Returns a line number pseudo-instruction.

Method Detail

lineback to summary
public int line()

Returns the line number.

Returns:int

the line number

ofback to summary
public static LineNumber of(int line)

Returns a line number pseudo-instruction.

Parameters
line:int

the line number

Returns:LineNumber

a line number pseudo-instruction

Exceptions
IllegalArgumentException:
if line is not u2