Package Summary Overview Summary

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

# Interface TypeCheckInstruction

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `InstructionPREVIEW`

public sealed interface TypeCheckInstruction extends InstructionPREVIEW
`TypeCheckInstruction` is a preview API of the Java platform.
Programs can only use `TypeCheckInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an `instanceof` or `checkcast` instruction in the `code` array of a `Code` attribute. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static TypeCheckInstructionPREVIEW`
  `of (OpcodePREVIEW op, ClassEntryPREVIEW type)`
  Returns a type check instruction.
  `static TypeCheckInstructionPREVIEW`
  `of (OpcodePREVIEW op, ClassDesc type)`
  Returns a type check instruction.
  `ClassEntryPREVIEW`
  `type()`
  Returns the type against which the instruction checks or casts.

  ### Methods declared in interface java.lang.classfile.InstructionPREVIEW

  `opcode, sizeInBytes`

- ## Method Details

  - ### type

    ClassEntryPREVIEW type()
    Returns the type against which the instruction checks or casts.
    Returns:
      the type against which the instruction checks or casts

  - ### of

    static TypeCheckInstructionPREVIEW of (OpcodePREVIEW op, ClassEntryPREVIEW type)
    Returns a type check instruction.
    Parameters:
      `op` - the opcode for the specific type of type check instruction, which must be of kind `Opcode.Kind.TYPE_CHECK`PREVIEW
      `type` - the type against which to check or cast
    Returns:
      a type check instruction

  - ### of

    static TypeCheckInstructionPREVIEW of (OpcodePREVIEW op, ClassDesc type)
    Returns a type check instruction.
    Parameters:
      `op` - the opcode for the specific type of type check instruction, which must be of kind `Opcode.Kind.TYPE_CHECK`PREVIEW
      `type` - the type against which to check or cast
    Returns:
      a type check instruction