public sealed interface CharacterRangeInfo
CharacterRangeInfo
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a single character range in the
CharacterRangeTableAttribute
PREVIEW.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the encoded end of the character range region (exclusive).int
Returns the encoded start of the character range region (inclusive).int
endPc()
Returns the end of the character range region (exclusive).int
flags()
The value of the flags item describes the kind of range.static CharacterRangeInfoPREVIEW
of
(int startPc, int endPc, int characterRangeStart, int characterRangeEnd, int flags) Returns a character range description.int
startPc()
Returns the start of the character range region (inclusive).
-
Method Details
-
startPc
int startPc()Returns the start of the character range region (inclusive). This is the index into the code array at which the code for this character range begins.- Returns:
- the start of the character range region (inclusive)
-
endPc
int endPc()Returns the end of the character range region (exclusive). This is the index into the code array after which the code for this character range ends.- Returns:
- the end of the character range region (exclusive)
-
characterRangeStart
int characterRangeStart()Returns the encoded start of the character range region (inclusive). The value is constructed from the line_number/column_number pair as given byline_number << 10 + column_number
, where the source file is viewed as an array of (possibly multi-byte) characters.- Returns:
- the encoded start of the character range region (inclusive)
-
characterRangeEnd
int characterRangeEnd()Returns the encoded end of the character range region (exclusive).. The value is constructed from the line_number/column_number pair as given byline_number << 10 + column_number
, where the source file is viewed as an array of (possibly multi-byte) characters.- Returns:
- the encoded end of the character range region (exclusive)
-
flags
int flags()The value of the flags item describes the kind of range. Multiple flags may be set within flags.ClassFile.CRT_STATEMENT
PREVIEW Range is a Statement (except ExpressionStatement), StatementExpression 14.8, as well as each VariableDeclaratorId = VariableInitializer of LocalVariableDeclarationStatement 14.4 or FieldDeclaration 8.3 in the grammar.ClassFile.CRT_BLOCK
PREVIEW Range is a Block in the grammar.ClassFile.CRT_ASSIGNMENT
PREVIEW Range is an assignment expression - Expression1 AssignmentOperator Expression1 in the grammar as well as increment and decrement expressions (both prefix and postfix).ClassFile.CRT_FLOW_CONTROLLER
PREVIEW An expression whose value will effect control flow.Flowcon
in 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
ClassFile.CRT_FLOW_TARGET
PREVIEW Statement or expression effected by a CRT_FLOW_CONTROLLER.Flowtarg
in 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
ClassFile.CRT_INVOKE
PREVIEW Method invocation. For example: Identifier Arguments.ClassFile.CRT_CREATE
PREVIEW New object creation. For example: new Creator.ClassFile.CRT_BRANCH_TRUE
PREVIEW A 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 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.ClassFile.CRT_BRANCH_FALSE
PREVIEW A 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 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
static CharacterRangeInfoPREVIEW of(int startPc, int endPc, int characterRangeStart, int characterRangeEnd, int flags) Returns a character range description.- Parameters:
startPc
- the start of the bytecode range, inclusiveendPc
- the end of the bytecode range, exclusivecharacterRangeStart
- the start of the character range, inclusive, encoded asline_number << 10 + column_number
characterRangeEnd
- the end of the character range, exclusive, encoded asline_number << 10 + column_number
flags
- the range flags- Returns:
- a character range description
-
CharacterRangeInfo
when preview features are enabled.