Interface CharacterRangeInfo
public sealed interface CharacterRangeInfo
CharacterRangeTableAttribute. Each character range entry associates a range of indices in the code array with a range of character positions in the source file. A character position in the source file is represented by a line number and a column number, and its value is encoded as lineNumber << 10 + columnNumber. Note that column numbers are not the same as byte indices in a column as multibyte characters may be present in the source file. Each character range entry includes a flag which indicates what kind of range is described: statement, assignment, method call, etc.
- Since:
- 24
- See Also:
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
int |
characterRangeEnd() |
Returns the encoded end of character positions in the source file, exclusive. |
int |
characterRangeStart() |
Returns the encoded start of character positions in the source file, inclusive. |
int |
endPc() |
Returns the end of indices in the code array, exclusive. |
int |
flags() |
Returns the flags of this character range entry. |
static CharacterRangeInfo |
of |
Returns a character range entry. |
int |
startPc() |
Returns the start of indices in the code array, inclusive. |
Method Details
startPc
int startPc()
- Returns:
- the start of indices in the code array, inclusive
- See Also:
endPc
int endPc()
- Returns:
- the end of indices in the code array, exclusive
- See Also:
characterRangeStart
int characterRangeStart()
- Returns:
- the encoded start of character positions in the source file, inclusive
characterRangeEnd
int characterRangeEnd()
- Returns:
- the encoded end of character positions in the source file, exclusive
flags
int flags()
The value of the flags item describes the kind of range. Multiple flags may be set within flags.
-
CharacterRange.FLAG_STATEMENTRange is a Statement (except ExpressionStatement), StatementExpression (JLS §14.8), as well as eachVariableDeclaratorId = VariableInitializerof LocalVariableDeclarationStatement (JLS §14.4) or FieldDeclaration (JLS §8.3) in the grammar. -
CharacterRange.FLAG_BLOCKRange is a Block in the grammar. -
CharacterRange.FLAG_ASSIGNMENTRange is an assignment expression -Expression1 AssignmentOperator Expression1in the grammar as well as increment and decrement expressions (both prefix and postfix). -
CharacterRange.FLAG_FLOW_CONTROLLERAn expression whose value will affect control flow.Flowconin the following:if ( Flowcon ) Statement [else Statement] for ( ForInitOpt ; [Flowcon] ; ForUpdateOpt ) Statement while ( Flowcon ) Statement do Statement while ( Flowcon ) ; switch ( Flowcon ) { SwitchBlockStatementGroups } Flowcon || Expression3 Flowcon && Expression3 Flowcon ? Expression : Expression1 -
CharacterRange.FLAG_FLOW_TARGETStatement or expression effected by a CRT_FLOW_CONTROLLER.Flowtargin the following:if ( Flowcon ) Flowtarg [else Flowtarg] for ( ForInitOpt ; [Flowcon] ; ForUpdateOpt ) Flowtarg while ( Flowcon ) Flowtarg do Flowtarg while ( Flowcon ) ; Flowcon || Flowtarg Flowcon && Flowtarg Flowcon ? Flowtarg : Flowtarg
-
CharacterRange.FLAG_INVOKEMethod invocation. For example: Identifier Arguments. -
CharacterRange.FLAG_CREATENew object creation. For example: new Creator. -
CharacterRange.FLAG_BRANCH_TRUEA condition encoded in the branch instruction immediately contained in the code range for this item is not inverted towards the corresponding branch condition in the source code. I.e. actual jump occurs if and only if the source code branch condition evaluates to true. Entries of this type are produced only for conditions that are listed in the description of CRT_FLOW_CONTROLLER flag. The source range for the entry contains flow controlling expression. start_pc field for an entry of this type must point to a branch instruction: if_acmp<cond>, if_icmp<cond>, if<cond>, ifnonull, ifnull or goto. CRT_BRANCH_TRUE and CRT_BRANCH_FALSE are special kinds of entries that can be used to determine what branch of a condition was chosen during the runtime. -
CharacterRange.FLAG_BRANCH_FALSEA condition encoded in the branch instruction immediately contained in the code range for this item is inverted towards the corresponding branch condition in the source code. I.e. actual jump occurs if and only if the source code branch condition evaluates to false. Entries of this type are produced only for conditions that are listed in the description of CRT_FLOW_CONTROLLER flag. The source range for the entry contains flow controlling expression. start_pc field for an entry of this type must point to a branch instruction: if_acmp<cond>, if_icmp<cond>, if<cond>, ifnonull, ifnull or goto.
All bits of the flags item not assigned above are reserved for future use. They should be set to zero in generated class files and should be ignored by Java virtual machine implementations.
- Returns:
- the flags of this character range entry
- See Also:
of
static CharacterRangeInfo of(int startPc, int endPc, int characterRangeStart, int characterRangeEnd, int flags)
- API Note:
- The created entry cannot be written to a
CodeBuilder. UseCodeBuilder::characterRangeinstead. - Parameters:
-
startPc- the start of indices in the code array, inclusive -
endPc- the end of indices in the code array, exclusive -
characterRangeStart- the encoded start of character positions in the source file, inclusive -
characterRangeEnd- the encoded end of character positions in the source file, exclusive -
flags- the flags of this entry - Returns:
- a character range entry
- Throws:
-
IllegalArgumentException- ifstartPc,endPc, orflagsis notu2
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.