APIdia Launch Partner
Top Description Methods
java.lang.classfile.constantpool

public sealed Interface MethodHandleEntry

extends LoadableConstantEntry
permits MethodHandleEntryImpl
Known Direct Implementers
jdk.internal.classfile.impl.AbstractPoolEntry.MethodHandleEntryImpl
Imports
java.lang.constant.ConstantDesc, .DirectMethodHandleDesc, java.lang.invoke.MethodHandle, .MethodHandleInfo, jdk.internal.classfile.impl.AbstractPoolEntry

Models a CONSTANT_MethodHandle_info structure, or a symbolic reference to a method handle, in the constant pool of a class file. The method handle directly accesses an accessible method, field, or constructor.

The use of a MethodHandleEntry is modeled by a DirectMethodHandleDesc. Conversions are through ConstantPoolBuilder#methodHandleEntry(DirectMethodHandleDesc) and asSymbol().

A method handle entry is composite:

MethodHandleEntry( int refKind, MemberRefEntry reference )
MethodHandleEntry(
    int refKind,
    MemberRefEntry reference
)
where refKind is in the range [1, 9].
Since
24
Java Virtual Machine Specification
4.4.8 The CONSTANT_MethodHandle_info Structure
See Also
ConstantPoolBuilder::methodHandleEntry

Method Summary

Modifier and TypeMethod and Description
public DirectMethodHandleDesc

Returns:

a symbolic descriptor for this method handle
asSymbol
()

Returns a symbolic descriptor for this method handle.

public default ConstantDesc
constantValue()

Implements java.lang.classfile.constantpool.LoadableConstantEntry.constantValue.

Returns a symbolic descriptor of this constant.

public int

Returns:

the reference kind of this method handle (JVMS 4.4.8)
kind
()

Returns the reference kind of this method handle (JVMS 4.4.8).

public MemberRefEntry

Returns:

the constant pool entry describing the field or method, according to the reference kind
reference
()

Returns the constant pool entry describing the field or method, according to the reference kind.

Inherited from java.lang.classfile.constantpool.LoadableConstantEntry:
typeKind

Method Detail

asSymbolback to summary
public DirectMethodHandleDesc asSymbol()

Returns a symbolic descriptor for this method handle.

Returns:DirectMethodHandleDesc

a symbolic descriptor for this method handle

See Also
ConstantPoolBuilder::methodHandleEntry(DirectMethodHandleDesc)
constantValueback to summary
public default ConstantDesc constantValue()

Implements java.lang.classfile.constantpool.LoadableConstantEntry.constantValue.

Doc from java.lang.classfile.constantpool.LoadableConstantEntry.constantValue.

Returns a symbolic descriptor of this constant.

This is equivalent to asSymbol().

Annotations
@Override
kindback to summary
public int kind()

Returns the reference kind of this method handle (JVMS 4.4.8).

Returns:int

the reference kind of this method handle (JVMS 4.4.8)

See Also
Reference kinds
referenceback to summary
public MemberRefEntry reference()

Returns the constant pool entry describing the field or method, according to the reference kind.

Returns:MemberRefEntry

the constant pool entry describing the field or method, according to the reference kind