Module java.base
Package java.lang.classfile.instructionPREVIEW

# Interface CharacterRange

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `PseudoInstructionPREVIEW`

public sealed interface CharacterRange extends PseudoInstructionPREVIEW
`CharacterRange` is a preview API of the Java platform.
Programs can only use `CharacterRange` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A pseudo-instruction which models a single entry in the `CharacterRangeTableAttribute`PREVIEW. Delivered as a `CodeElement`PREVIEW during traversal of the elements of a `CodeModel`PREVIEW, according to the setting of the `ClassFile.DebugElementsOption`PREVIEW option.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `characterRangeEnd()`
  Returns the encoded end of the character range region (exclusive).
  `int`
  `characterRangeStart()`
  Returns the encoded start of the character range region (inclusive).
  `LabelPREVIEW`
  `endScope()`
  Returns the end of the instruction range.
  `int`
  `flags()`
  A flags word, indicating the kind of range.
  `static CharacterRangePREVIEW`
  `of(LabelPREVIEW startScope, LabelPREVIEW endScope, int characterRangeStart, int characterRangeEnd, int flags)`
  Returns a character range pseudo-instruction.
  `LabelPREVIEW`
  `startScope()`
  Returns the start of the instruction range.

- ## Method Details

  - ### startScope

    LabelPREVIEW startScope()
    Returns the start of the instruction range.
    Returns:
      the start of the instruction range

  - ### endScope

    LabelPREVIEW endScope()
    Returns the end of the instruction range.
    Returns:
      the end of the instruction range

  - ### 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 by `line_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 by `line_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()
    A flags word, indicating the kind of range. Multiple flag bits may be set. Valid flags include `ClassFile.CRT_STATEMENT`PREVIEW, `ClassFile.CRT_BLOCK`PREVIEW, `ClassFile.CRT_ASSIGNMENT`PREVIEW, `ClassFile.CRT_FLOW_CONTROLLER`PREVIEW, `ClassFile.CRT_FLOW_TARGET`PREVIEW, `ClassFile.CRT_INVOKE`PREVIEW, `ClassFile.CRT_CREATE`PREVIEW, `ClassFile.CRT_BRANCH_TRUE`PREVIEW, `ClassFile.CRT_BRANCH_FALSE`PREVIEW.
    Returns:
      the flags
    See Also:
      - `CharacterRangeInfo.flags()`PREVIEW

  - ### of

    static CharacterRangePREVIEW of(LabelPREVIEW startScope, LabelPREVIEW endScope, int characterRangeStart, int characterRangeEnd, int flags)
    Returns a character range pseudo-instruction.
    Parameters:
      `startScope` - the start of the instruction range
      `endScope` - the end of the instruction range
      `characterRangeStart` - the encoded start of the character range region (inclusive)
      `characterRangeEnd` - the encoded end of the character range region (exclusive)
      `flags` - a flags word, indicating the kind of range
    Returns:
      a character range pseudo-instruction