APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.constant

public final Class DirectMethodHandleDescImpl

extends Object
implements DirectMethodHandleDesc
Class Inheritance
All Implemented Interfaces
java.lang.constant.DirectMethodHandleDesc, java.lang.constant.MethodHandleDesc, java.lang.constant.ConstantDesc
Imports
java.lang.constant.ClassDesc, .DirectMethodHandleDesc, .MethodTypeDesc, java.lang.invoke.MethodHandle, .MethodHandles, .MethodType, java.util.Objects

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

Field Summary

Modifier and TypeField and Description
private final MethodTypeDesc
private final DirectMethodHandleDesc.Kind
private final String
private final ClassDesc

Constructor Summary

AccessConstructor and Description
public
DirectMethodHandleDescImpl(DirectMethodHandleDesc.Kind
the kind of the method handle
kind
,
ClassDesc
the declaring class or interface for the method
owner
,
String
the unqualified name of the method (ignored if kind is CONSTRUCTOR)
name
,
MethodTypeDesc
the lookup type of the method
type
)

Constructs a DirectMethodHandleDescImpl for a method or field from a kind, owner, name, and type

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the specified DirectMethodHandleDescImpl is equal to this DirectMethodHandleDescImpl.
equals
(Object
a DirectMethodHandleDescImpl to compare to this DirectMethodHandleDescImpl
o
)

Overrides java.lang.Object.equals.

Implements java.lang.constant.MethodHandleDesc.equals.

Returns true if this DirectMethodHandleDescImpl is equal to another DirectMethodHandleDescImpl.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public MethodTypeDesc
invocationType()

Implements java.lang.constant.MethodHandleDesc.invocationType.

Returns a MethodTypeDesc describing the invocation type of the method handle described by this nominal descriptor.

public boolean
isOwnerInterface()

Implements java.lang.constant.DirectMethodHandleDesc.isOwnerInterface.

Indicates if the method is declared by an interface

public DirectMethodHandleDesc.Kind
kind()

Implements java.lang.constant.DirectMethodHandleDesc.kind.

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

public String
lookupDescriptor()

Implements java.lang.constant.DirectMethodHandleDesc.lookupDescriptor.

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

public String
methodName()

Implements java.lang.constant.DirectMethodHandleDesc.methodName.

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

public ClassDesc
owner()

Implements java.lang.constant.DirectMethodHandleDesc.owner.

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

public int
refKind()

Implements java.lang.constant.DirectMethodHandleDesc.refKind.

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

public MethodHandle
resolveConstantDesc(MethodHandles.Lookup lookup)

Implements java.lang.constant.MethodHandleDesc.resolveConstantDesc.

Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

private static void
private static void
validateFieldType(MethodTypeDesc type, boolean isSetter, boolean isVirtual)

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

invocationTypeback to summary
private final MethodTypeDesc invocationType
kindback to summary
private final DirectMethodHandleDesc.Kind kind
nameback to summary
private final String name
ownerback to summary
private final ClassDesc owner

Constructor Detail

DirectMethodHandleDescImplback to summary
public DirectMethodHandleDescImpl(DirectMethodHandleDesc.Kind kind, ClassDesc owner, String name, MethodTypeDesc type)

Constructs a DirectMethodHandleDescImpl for a method or field from a kind, owner, name, and type

Parameters
kind:DirectMethodHandleDesc.Kind

the kind of the method handle

owner:ClassDesc

the declaring class or interface for the method

name:String

the unqualified name of the method (ignored if kind is CONSTRUCTOR)

type:MethodTypeDesc

the lookup type of the method

Exceptions
NullPointerException:
if any non-ignored argument is null
IllegalArgumentException:
if kind describes a field accessor, and type is not consistent with that kind of field accessor, or if kind describes a constructor, and the return type of type is not void
Java Virtual Machine Specification
4.2.2 Unqualified Names

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Implements java.lang.constant.MethodHandleDesc.equals.

Returns true if this DirectMethodHandleDescImpl is equal to another DirectMethodHandleDescImpl. Equality is determined by the two descriptors having equal kind, owner, name, and type descriptor.

Parameters
o:Object

a DirectMethodHandleDescImpl to compare to this DirectMethodHandleDescImpl

Returns:boolean

true if the specified DirectMethodHandleDescImpl is equal to this DirectMethodHandleDescImpl.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
invocationTypeback to summary
public MethodTypeDesc invocationType()

Implements java.lang.constant.MethodHandleDesc.invocationType.

Doc from java.lang.constant.MethodHandleDesc.invocationType.

Returns a MethodTypeDesc describing the invocation type of the method handle described by this nominal descriptor. The invocation type describes the full set of stack values that are consumed by the invocation (including the receiver, if any).

Annotations
@Override
isOwnerInterfaceback to summary
public boolean isOwnerInterface()

Implements java.lang.constant.DirectMethodHandleDesc.isOwnerInterface.

Doc from java.lang.constant.DirectMethodHandleDesc.isOwnerInterface.

Indicates if the method is declared by an interface

Annotations
@Override
kindback to summary
public DirectMethodHandleDesc.Kind kind()

Implements java.lang.constant.DirectMethodHandleDesc.kind.

Doc from java.lang.constant.DirectMethodHandleDesc.kind.

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

Annotations
@Override
lookupDescriptorback to summary
public String lookupDescriptor()

Implements java.lang.constant.DirectMethodHandleDesc.lookupDescriptor.

Doc from java.lang.constant.DirectMethodHandleDesc.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).

Annotations
@Override
methodNameback to summary
public String methodName()

Implements java.lang.constant.DirectMethodHandleDesc.methodName.

Doc from java.lang.constant.DirectMethodHandleDesc.methodName.

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

Annotations
@Override
ownerback to summary
public ClassDesc owner()

Implements java.lang.constant.DirectMethodHandleDesc.owner.

Doc from java.lang.constant.DirectMethodHandleDesc.owner.

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

Annotations
@Override
refKindback to summary
public int refKind()

Implements java.lang.constant.DirectMethodHandleDesc.refKind.

Doc from java.lang.constant.DirectMethodHandleDesc.refKind.

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

Annotations
@Override
resolveConstantDescback to summary
public MethodHandle resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException

Implements java.lang.constant.MethodHandleDesc.resolveConstantDesc.

Doc from java.lang.constant.ConstantDesc.resolveConstantDesc.

Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4. The resolution and access control context is provided by the MethodHandles.Lookup parameter. No caching of the resulting value is performed.

Exceptions
ReflectiveOperationException:
if a class, method, or field could not be reflectively resolved in the course of resolution
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
validateConstructorback to summary
private static void validateConstructor(MethodTypeDesc type)
validateFieldTypeback to summary
private static void validateFieldType(MethodTypeDesc type, boolean isSetter, boolean isVirtual)