public interface ConstantDesc
resolveConstantDesc(MethodHandles.Lookup)to yield the constant value itself.
Class names in a nominal descriptor, like class names in the constant pool of a classfile, must be interpreted with respect to a particular class loader, which is not part of the nominal descriptor.
Static constants that are expressible natively in the constant pool (
ConstantDesc, and serve as nominal descriptors for themselves.
Native linkable constants (
MethodHandle) have counterpart ConstantDesc types:
Other constants are represented by subtypes of
APIs that perform generation or parsing of bytecode are encouraged to use
ConstantDesc to describe the operand of an
(including dynamic constants), the static bootstrap arguments of
dynamic constants and
invokedynamic instructions, and other
bytecodes or classfile structures that make use of the constant pool.
Nominal descriptors should be compared using the
Object.equals(Object) method. There is no guarantee that any
particular entity will always be represented by the same descriptor instance.
sealedinterface, which would prohibit subclassing except by explicitly permitted types. Clients can assume that the following set of subtypes is exhaustive:
DynamicConstantDesc; this list may be extended to reflect future changes to the constant pool format as defined in JVMS 4.4.
Object resolveConstantDesc(MethodHandles.Lookup lookup) throws ReflectiveOperationException
MethodHandles.Lookupparameter. No caching of the resulting value is performed.
MethodHandles.Lookupto provide name resolution and access control context
ReflectiveOperationException- if a class, method, or field could not be reflectively resolved in the course of resolution
LinkageError- if a linkage error occurs