Top Description Inners Methods
java.lang.constant

public sealed Interface DirectMethodHandleDesc

extends MethodHandleDesc
Known Direct Implementers
jdk.internal.constant.DirectMethodHandleDescImpl
Imports
java.lang.invoke.MethodHandle, .MethodHandleInfo, jdk.internal.constant.DirectMethodHandleDescImpl, jdk.internal.vm.annotation.Stable

A nominal descriptor for a direct MethodHandle. A DirectMethodHandleDesc corresponds to a Constant_MethodHandle_info entry in the constant pool of a classfile.
Since
12

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
DirectMethodHandleDesc.Kind

Kinds of method handles that can be described with DirectMethodHandleDesc.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the method is declared by an interface
isOwnerInterface
()

Indicates if the method is declared by an interface

public DirectMethodHandleDesc.Kind

Returns:

the Kind
kind
()

Returns the kind of the method handle described by this nominal descriptor.

public String

Returns:

the lookup descriptor string
lookupDescriptor
()

Returns the lookup descriptor of the method handle described by this descriptor, after adjusting for the invocation mode.

public String

Returns:

the name of the method or field
methodName
()

Returns the name of the method or field described by this nominal descriptor.

public ClassDesc

Returns:

the class declaring the method or field
owner
()

Returns a ClassDesc describing the class declaring the method or field described by this nominal descriptor.

public int

Returns:

the reference kind
refKind
()

Returns the refKind of the method handle described by this nominal reference, as defined by MethodHandleInfo.

Inherited from java.lang.constant.MethodHandleDesc:
asTypeequalsinvocationTypeofofConstructorofFieldofMethodresolveConstantDesc

Method Detail

isOwnerInterfaceback to summary
public boolean isOwnerInterface()

Indicates if the method is declared by an interface

Returns:boolean

true if the method is declared by an interface

kindback to summary
public DirectMethodHandleDesc.Kind kind()

Returns the kind of the method handle described by this nominal descriptor.

Returns:DirectMethodHandleDesc.Kind

the Kind

lookupDescriptorback to summary
public String lookupDescriptor()

Returns the lookup descriptor of the method handle described by this descriptor, after adjusting for the invocation mode. This will correspond to either a method type descriptor string (for methods and constructors), or a field descriptor string (for field access method handles). The lookup descriptor string is in the same format as accepted by MethodHandleDesc#of(Kind, ClassDesc, String, String).

Returns:String

the lookup descriptor string

methodNameback to summary
public String methodName()

Returns the name of the method or field described by this nominal descriptor. For constructors, returns the reserved name <init>.

Returns:String

the name of the method or field

ownerback to summary
public ClassDesc owner()

Returns a ClassDesc describing the class declaring the method or field described by this nominal descriptor.

Returns:ClassDesc

the class declaring the method or field

refKindback to summary
public int refKind()

Returns the refKind of the method handle described by this nominal reference, as defined by MethodHandleInfo.

Returns:int

the reference kind

java.lang.constant back to summary

public final Enum DirectMethodHandleDesc.Kind

extends Enum<DirectMethodHandleDesc.Kind>
Class Inheritance

Kinds of method handles that can be described with DirectMethodHandleDesc.
Since
12

Field Summary

Modifier and TypeField and Description
public static final DirectMethodHandleDesc.Kind
CONSTRUCTOR

A method handle for a constructor

public static final DirectMethodHandleDesc.Kind
GETTER

A method handle for a read accessor for an instance field

public static final DirectMethodHandleDesc.Kind
INTERFACE_SPECIAL

A method handle for an interface method invoked as with invokespecial

public static final DirectMethodHandleDesc.Kind
INTERFACE_STATIC

A method handle for a method invoked as with invokestatic

public static final DirectMethodHandleDesc.Kind
INTERFACE_VIRTUAL

A method handle for a method invoked as with invokeinterface

public final boolean
isInterface

Is this an interface

public final int
refKind

The corresponding refKind value for this kind of method handle, as defined by MethodHandleInfo

public static final DirectMethodHandleDesc.Kind
SETTER

A method handle for a write accessor for an instance field

public static final DirectMethodHandleDesc.Kind
SPECIAL

A method handle for a method invoked as with invokespecial

public static final DirectMethodHandleDesc.Kind
STATIC

A method handle for a method invoked as with invokestatic

public static final DirectMethodHandleDesc.Kind
STATIC_GETTER

A method handle for a read accessor for a static field

public static final DirectMethodHandleDesc.Kind
STATIC_SETTER

A method handle for a write accessor for a static field

private static final DirectMethodHandleDesc.Kind[]
public static final DirectMethodHandleDesc.Kind
VIRTUAL

A method handle for a method invoked as with invokevirtual

Constructor Summary

AccessConstructor and Description
private
Kind(int refKind)

private
Kind(int refKind, boolean isInterface)

Method Summary

Modifier and TypeMethod and Description
private static int
tableIndex(int refKind, boolean isInterface)

public static DirectMethodHandleDesc.Kind
public static DirectMethodHandleDesc.Kind

Returns:

the matching enumeration member
valueOf
(int
refKind of desired member
refKind
)

Returns the enumeration member with the given refKind field.

public static DirectMethodHandleDesc.Kind

Returns:

the matching enumeration member
valueOf
(int
refKind of desired member
refKind
,
boolean
whether desired member is for interface methods
isInterface
)

Returns the enumeration member with the given the refKind and isInterface arguments.

public static DirectMethodHandleDesc.Kind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONSTRUCTORback to summary
public static final DirectMethodHandleDesc.Kind CONSTRUCTOR

A method handle for a constructor

GETTERback to summary
public static final DirectMethodHandleDesc.Kind GETTER

A method handle for a read accessor for an instance field

INTERFACE_SPECIALback to summary
public static final DirectMethodHandleDesc.Kind INTERFACE_SPECIAL

A method handle for an interface method invoked as with invokespecial

INTERFACE_STATICback to summary
public static final DirectMethodHandleDesc.Kind INTERFACE_STATIC

A method handle for a method invoked as with invokestatic

INTERFACE_VIRTUALback to summary
public static final DirectMethodHandleDesc.Kind INTERFACE_VIRTUAL

A method handle for a method invoked as with invokeinterface

isInterfaceback to summary
public final boolean isInterface

Is this an interface

refKindback to summary
public final int refKind

The corresponding refKind value for this kind of method handle, as defined by MethodHandleInfo

SETTERback to summary
public static final DirectMethodHandleDesc.Kind SETTER

A method handle for a write accessor for an instance field

SPECIALback to summary
public static final DirectMethodHandleDesc.Kind SPECIAL

A method handle for a method invoked as with invokespecial

STATICback to summary
public static final DirectMethodHandleDesc.Kind STATIC

A method handle for a method invoked as with invokestatic

STATIC_GETTERback to summary
public static final DirectMethodHandleDesc.Kind STATIC_GETTER

A method handle for a read accessor for a static field

STATIC_SETTERback to summary
public static final DirectMethodHandleDesc.Kind STATIC_SETTER

A method handle for a write accessor for a static field

TABLEback to summary
private static final DirectMethodHandleDesc.Kind[] TABLE
Annotations
@Stable
VIRTUALback to summary
public static final DirectMethodHandleDesc.Kind VIRTUAL

A method handle for a method invoked as with invokevirtual

Constructor Detail

Kindback to summary
private Kind(int refKind)
Kindback to summary
private Kind(int refKind, boolean isInterface)

Method Detail

tableIndexback to summary
private static int tableIndex(int refKind, boolean isInterface)
valueOfback to summary
public static DirectMethodHandleDesc.Kind valueOf(String name)
valueOfback to summary
public static DirectMethodHandleDesc.Kind valueOf(int refKind)

Returns the enumeration member with the given refKind field. Behaves as if valueOf(refKind, false). As a special case, if refKind is REF_invokeInterface (9) then the isInterface field will be true.

Parameters
refKind:int

refKind of desired member

Returns:DirectMethodHandleDesc.Kind

the matching enumeration member

Exceptions
IllegalArgumentException:
if there is no such member
valueOfback to summary
public static DirectMethodHandleDesc.Kind valueOf(int refKind, boolean isInterface)

Returns the enumeration member with the given the refKind and isInterface arguments. For most values of refKind there is an exact match regardless of the value of isInterface. These are:

  • REF_invokeVirtual which matches to VIRTUAL
  • REF_invokeInterface which matches to INTERFACE_VIRTUAL
  • REF_newInvokeSpecial which matches to CONSTRUCTOR
  • REF_getField which matches to GETTER
  • REF_putField which matches to SETTER
  • REF_getStatic which matches to STATIC_GETTER
  • REF_putStatic which matches to STATIC_SETTER
As for the rest, the returned kind will depend on the value (false or true accordingly) of isInterface:
  • REF_invokeStatic which matches to STATIC or INTERFACE_STATIC
  • REF_invokeSpecial which matches to SPECIAL or INTERFACE_SPECIAL
Parameters
refKind:int

refKind of desired member

isInterface:boolean

whether desired member is for interface methods

Returns:DirectMethodHandleDesc.Kind

the matching enumeration member

Exceptions
IllegalArgumentException:
if there is no such member
valuesback to summary
public static DirectMethodHandleDesc.Kind[] values()