ClassFileElement, CodeElement, Instructionpublic sealed interface InvokeInstruction extends Instruction
code array of a
Code attribute, other than invokedynamic. Corresponding opcodes have a kind of Opcode.Kind.INVOKE. Delivered as a CodeElement when traversing the elements of a CodeModel. A method invocation instruction is composite:
InvokeInstruction(
Opcode opcode,
MethodRefEntry | InterfaceMethodRefEntry method)
)
method must be an InterfaceMethodRefEntry for invokeinterface opcode, and must be a
MethodRefEntry for invokevirtual opcode. invokestatic and invokespecial can have either type of entry for method.| Modifier and Type | Method | Description |
|---|---|---|
int |
count() |
Returns the count value of an invokeinterface instruction, or 0 for other instructions. |
boolean |
isInterface() |
Returns whether the class or interface holding the method is an interface. |
MemberRefEntry |
method() |
Returns the MethodRefEntry or InterfaceMethodRefEntry constant described by this instruction. |
default Utf8Entry |
name() |
Returns the name of the method. |
static InvokeInstruction |
of |
Returns an invocation instruction. |
static InvokeInstruction |
of |
Returns an invocation instruction. |
static InvokeInstruction |
of |
Returns an invocation instruction. |
default ClassEntry |
owner() |
Returns the class or interface holding the method. |
default Utf8Entry |
type() |
Returns the method descriptor string of the method. |
default MethodTypeDesc |
typeSymbol() |
Returns a symbolic descriptor for the method type. |
opcode, sizeInBytes
MemberRefEntry method()
MethodRefEntry or InterfaceMethodRefEntry constant described by this instruction.MethodRefEntry or InterfaceMethodRefEntry constant described by this instructionboolean isInterface()
int count()
count value of an invokeinterface instruction, or 0 for other instructions. For an invokeinterface instruction, this value must be equivalent to the sum of slot sizes of all arguments plus one, which is equal to the number of operand stack depth consumed by this interface method invocation instruction.
count value of an invokeinterface instruction, or 0 for other instructionsdefault ClassEntry owner()
default Utf8Entry name()
default Utf8Entry type()
typeSymbol().default MethodTypeDesc typeSymbol()
static InvokeInstruction of(Opcode op, MemberRefEntry method)
op - the opcode for the specific type of invocation instruction, which must be of kind Opcode.Kind.INVOKE
method - a constant pool entry describing the methodIllegalArgumentException - if the opcode kind is not Opcode.Kind.INVOKE
static InvokeInstruction of(Opcode op, ClassEntry owner, Utf8Entry name, Utf8Entry type, boolean isInterface)
op - the opcode for the specific type of invocation instruction, which must be of kind Opcode.Kind.INVOKE
owner - the class holding the methodname - the name of the methodtype - the method descriptorisInterface - whether the class holding the method is an interfaceIllegalArgumentException - if the opcode kind is not Opcode.Kind.INVOKE
static InvokeInstruction of(Opcode op, ClassEntry owner, NameAndTypeEntry nameAndType, boolean isInterface)
op - the opcode for the specific type of invocation instruction, which must be of kind Opcode.Kind.INVOKE
owner - the class holding the methodnameAndType - the name and type of the methodisInterface - whether the class holding the method is an interfaceIllegalArgumentException - if the opcode kind is not Opcode.Kind.INVOKE
© 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.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/instruction/InvokeInstruction.html