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

public sealed Interface ConstantDynamicEntry

extends DynamicConstantPoolEntry, LoadableConstantEntry
permits ConstantDynamicEntryImpl
Known Direct Implementers
jdk.internal.classfile.impl.AbstractPoolEntry.ConstantDynamicEntryImpl
Imports
java.lang.classfile.TypeKind, java.lang.constant.ClassDesc, .ConstantDesc, .DynamicConstantDesc, jdk.internal.classfile.impl.AbstractPoolEntry, .Util

Models a CONSTANT_Dynamic_info structure, representing a dynamically-computed constant, in the constant pool of a class file.

The use of a ConstantDynamicEntry is modeled by a DynamicConstantDesc. Conversions are through asSymbol() and ConstantPoolBuilder#constantDynamicEntry(DynamicConstantDesc).

A dynamic constant entry is composite:

ConstantDynamicEntry( BootstrapMethodEntry bootstrap, NameAndTypeEntry nameAndType )
ConstantDynamicEntry(
    BootstrapMethodEntry bootstrap,
    NameAndTypeEntry nameAndType
)
where nameAndType.type() is a field descriptor string.

API Note

A dynamically-computed constant is frequently called a dynamic constant, or a condy, from the abbreviation of "constant dynamic".

Since
24
Java Virtual Machine Specification
4.4.10 The CONSTANT_Dynamic_info and CONSTANT_InvokeDynamic_info Structures
See Also
ConstantPoolBuilder::constantDynamicEntry, DynamicConstantDesc, Dynamically-computed constants

Method Summary

Modifier and TypeMethod and Description
public default DynamicConstantDesc<?>

Returns:

a symbolic descriptor for this dynamically-computed constant
asSymbol
()

Returns a symbolic descriptor for this dynamically-computed constant.

public default ConstantDesc
constantValue()

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

Returns a symbolic descriptor of this constant.

public default TypeKind
typeKind()

Overrides default java.lang.classfile.constantpool.LoadableConstantEntry.typeKind.

Returns the data type of this constant.

public default ClassDesc

Returns:

a symbolic descriptor for the field type of this dynamically-computed constant
typeSymbol
()

Returns a symbolic descriptor for the field type of this dynamically-computed constant.

Inherited from java.lang.classfile.constantpool.DynamicConstantPoolEntry:
bootstrapbootstrapMethodIndexnamenameAndTypetype

Method Detail

asSymbolback to summary
public default DynamicConstantDesc<?> asSymbol()

Returns a symbolic descriptor for this dynamically-computed constant.

Returns:DynamicConstantDesc<?>

a symbolic descriptor for this dynamically-computed constant

See Also
ConstantPoolBuilder::constantDynamicEntry(DynamicConstantDesc)
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
typeKindback to summary
public default TypeKind typeKind()

Overrides default java.lang.classfile.constantpool.LoadableConstantEntry.typeKind.

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

Returns the data type of this constant.

If the data type is of category 2, this constant must be loaded with ldc2_w; otherwise, the data type is of category 1, and this constant must be loaded with ldc or ldc_w.

API Note

The data type of a dynamically-computed constant depends on its descriptor, while the data type of all other constants can be determined by their constant type.

Annotations
@Override
typeSymbolback to summary
public default ClassDesc typeSymbol()

Returns a symbolic descriptor for the field type of this dynamically-computed constant.

Returns:ClassDesc

a symbolic descriptor for the field type of this dynamically-computed constant