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

# Interface InvokeInstruction

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

public sealed interface InvokeInstruction extends InstructionPREVIEW
`InvokeInstruction` is a preview API of the Java platform.
Programs can only use `InvokeInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a method invocation instruction in the `code` array of a `Code` attribute, other than `invokedynamic`. Corresponding opcodes will have a `kind` of `Opcode.Kind.INVOKE`PREVIEW. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `count()`
  Returns for an `invokeinterface`, the `count` value, as defined in 6.5.
  `boolean`
  `isInterface()`
  Returns whether the class holding the method is an interface.
  `MemberRefEntryPREVIEW`
  `method()`
  Returns the `MethodRefEntry`PREVIEW or `InterfaceMethodRefEntry`PREVIEW constant described by this instruction.
  `default Utf8EntryPREVIEW`
  `name()`
  Returns the name of the method.
  `static InvokeInstructionPREVIEW`
  `of(OpcodePREVIEW op, ClassEntryPREVIEW owner, NameAndTypeEntryPREVIEW nameAndType, boolean isInterface)`
  Returns an invocation instruction.
  `static InvokeInstructionPREVIEW`
  `of(OpcodePREVIEW op, ClassEntryPREVIEW owner, Utf8EntryPREVIEW name, Utf8EntryPREVIEW type, boolean isInterface)`
  Returns an invocation instruction.
  `static InvokeInstructionPREVIEW`
  `of(OpcodePREVIEW op, MemberRefEntryPREVIEW method)`
  Returns an invocation instruction.
  `default ClassEntryPREVIEW`
  `owner()`
  Returns the class holding the method.
  `default Utf8EntryPREVIEW`
  `type()`
  Returns the method descriptor of the method.
  `default MethodTypeDesc`
  `typeSymbol()`
  Returns a symbolic descriptor for the method type.

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

  `opcode, sizeInBytes`

- ## Method Details

  - ### method

    MemberRefEntryPREVIEW method()
    Returns the `MethodRefEntry`PREVIEW or `InterfaceMethodRefEntry`PREVIEW constant described by this instruction.
    Returns:
      the `MethodRefEntry`PREVIEW or `InterfaceMethodRefEntry`PREVIEW constant described by this instruction

  - ### isInterface

    boolean isInterface()
    Returns whether the class holding the method is an interface.
    Returns:
      whether the class holding the method is an interface

  - ### count

    int count()
    Returns for an `invokeinterface`, the `count` value, as defined in 6.5.
    Returns:
      for an `invokeinterface`, the `count` value, as defined in 6.5

  - ### owner

    default ClassEntryPREVIEW owner()
    Returns the class holding the method.
    Returns:
      the class holding the method

  - ### name

    default Utf8EntryPREVIEW name()
    Returns the name of the method.
    Returns:
      the name of the method

  - ### type

    default Utf8EntryPREVIEW type()
    Returns the method descriptor of the method.
    Returns:
      the method descriptor of the method

  - ### typeSymbol

    default MethodTypeDesc typeSymbol()
    Returns a symbolic descriptor for the method type.
    Returns:
      a symbolic descriptor for the method type

  - ### of

    static InvokeInstructionPREVIEW of(OpcodePREVIEW op, MemberRefEntryPREVIEW method)
    Returns an invocation instruction.
    Parameters:
      `op` - the opcode for the specific type of invocation instruction, which must be of kind `Opcode.Kind.INVOKE`PREVIEW
      `method` - a constant pool entry describing the method
    Returns:
      an invocation instruction

  - ### of

    static InvokeInstructionPREVIEW of(OpcodePREVIEW op, ClassEntryPREVIEW owner, Utf8EntryPREVIEW name, Utf8EntryPREVIEW type, boolean isInterface)
    Returns an invocation instruction.
    Parameters:
      `op` - the opcode for the specific type of invocation instruction, which must be of kind `Opcode.Kind.INVOKE`PREVIEW
      `owner` - the class holding the method
      `name` - the name of the method
      `type` - the method descriptor
      `isInterface` - whether the class holding the method is an interface
    Returns:
      an invocation instruction

  - ### of

    static InvokeInstructionPREVIEW of(OpcodePREVIEW op, ClassEntryPREVIEW owner, NameAndTypeEntryPREVIEW nameAndType, boolean isInterface)
    Returns an invocation instruction.
    Parameters:
      `op` - the opcode for the specific type of invocation instruction, which must be of kind `Opcode.Kind.INVOKE`PREVIEW
      `owner` - the class holding the method
      `nameAndType` - the name and type of the method
      `isInterface` - whether the class holding the method is an interface
    Returns:
      an invocation instruction