W3cubDocs

/OpenJDK 21

Class VarHandle.VarHandleDesc

java.lang.Object
java.lang.constant.DynamicConstantDesc<VarHandle>
java.lang.invoke.VarHandle.VarHandleDesc
All Implemented Interfaces:
ConstantDesc
Enclosing class:
VarHandle
public static final class VarHandle.VarHandleDesc extends DynamicConstantDesc<VarHandle>
A nominal descriptor for a VarHandle constant.
Since:
12

Method Summary

Modifier and Type Method Description
static VarHandle.VarHandleDesc ofArray(ClassDesc arrayClass)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for an array type.
static VarHandle.VarHandleDesc ofField(ClassDesc declaringClass, String name, ClassDesc fieldType)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for an instance field.
static VarHandle.VarHandleDesc ofStaticField(ClassDesc declaringClass, String name, ClassDesc fieldType)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for a static field.
String toString()
Returns a compact textual description of this constant description.
ClassDesc varType()
Returns a ClassDesc describing the type of the variable described by this descriptor.

Methods declared in class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Method Details

ofField

public static VarHandle.VarHandleDesc ofField(ClassDesc declaringClass, String name, ClassDesc fieldType)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for an instance field.
Parameters:
declaringClass - a ClassDesc describing the declaring class, for field var handles
name - the unqualified name of the field
fieldType - a ClassDesc describing the type of the field
Returns:
the VarHandle.VarHandleDesc
Throws:
NullPointerException - if any of the arguments are null
See Java Virtual Machine Specification:
4.2.2 Unqualified Names

ofStaticField

public static VarHandle.VarHandleDesc ofStaticField(ClassDesc declaringClass, String name, ClassDesc fieldType)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for a static field.
Parameters:
declaringClass - a ClassDesc describing the declaring class, for field var handles
name - the unqualified name of the field
fieldType - a ClassDesc describing the type of the field
Returns:
the VarHandle.VarHandleDesc
Throws:
NullPointerException - if any of the arguments are null
See Java Virtual Machine Specification:
4.2.2 Unqualified Names

ofArray

public static VarHandle.VarHandleDesc ofArray(ClassDesc arrayClass)
Returns a VarHandle.VarHandleDesc corresponding to a VarHandle for an array type.
Parameters:
arrayClass - a ClassDesc describing the type of the array
Returns:
the VarHandle.VarHandleDesc
Throws:
NullPointerException - if any of the arguments are null

varType

public ClassDesc varType()
Returns a ClassDesc describing the type of the variable described by this descriptor.
Returns:
the variable type

toString

public String toString()
Returns a compact textual description of this constant description. For a field VarHandle, includes the owner, name, and type of the field, and whether it is static; for an array VarHandle, the name of the component type.
Overrides:
toString in class DynamicConstantDesc<VarHandle>
Returns:
A compact textual description of this descriptor

© 1993, 2023, 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/21/docs/api/java.base/java/lang/invoke/VarHandle.VarHandleDesc.html