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

public sealed Interface CharacterRangeTableAttribute

extends Attribute<CharacterRangeTableAttribute>
permits BoundCharacterRangeTableAttribute, UnboundCharacterRangeTableAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundCharacterRangeTableAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundCharacterRangeTableAttribute
Imports
java.lang.classfile.Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassFile, .CodeBuilder, .CodeModel, java.lang.classfile.instruction.CharacterRange, java.util.List, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute

Models the CharacterRangeTable attribute, which is a bidirectional mapping from ranges of positions in the source file to ranges of indices into the code array. Its entries are delivered as CharacterRanges when traversing the elements of a CodeModel, toggled by ClassFile.DebugElementsOption.

The CharacterRangeTable attribute consists of an array of character range entries. The character range entries form a forest data structure: any two range entries are either disjoint, or if they overlap, then one entry must be enclosed within the other, both in code array indices and source file character positions. The character range entries may appear in any order.

This attribute only appears on Code attributes, permits multiple appearances but should only appear once in a Code attribute. It has a data dependency on labels.

This attribute cannot be sent to a CodeBuilder; its entries can be constructed with CharacterRange, resulting in at most one attribute instance in the built Code attribute.

This attribute is not predefined in the Java SE Platform. This is a JDK-specific nonstandard attribute produced by the reference implementation of the system Java compiler, defined by the jdk.compiler module.

Since
24
See Also
Attributes#characterRangeTable(), CompilationIDAttribute, SourceIDAttribute

Method Summary

Modifier and TypeMethod and Description
public List<CharacterRangeInfo>

Returns:

the entries of the character range table
characterRangeTable
()

Returns the entries of the character range table.

public static CharacterRangeTableAttribute

Returns:

a CharacterRangeTable attribute
of
(List<CharacterRangeInfo>
the descriptions of the character ranges
ranges
)

Returns a CharacterRangeTable attribute.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

characterRangeTableback to summary
public List<CharacterRangeInfo> characterRangeTable()

Returns the entries of the character range table.

Returns:List<CharacterRangeInfo>

the entries of the character range table

ofback to summary
public static CharacterRangeTableAttribute of(List<CharacterRangeInfo> ranges)

Returns a CharacterRangeTable attribute.

API Note

The created attribute cannot be written to a CodeBuilder. Use CodeBuilder::characterRange instead.

Parameters
ranges:List<CharacterRangeInfo>

the descriptions of the character ranges

Returns:CharacterRangeTableAttribute

a CharacterRangeTable attribute

Exceptions
IllegalArgumentException:
if the number of ranges exceeds the limit of u2