class file. Provides read and
write access to the constant pool that is being built. Writing is append-only (the index of new entries monotonically
increase) and idempotent (entry-bearing methods will return an existing entry
if there is a suitable one).
For class file building, an overload of ClassFile::build takes a
ConstantPoolBuilder. For class file transformations via
ClassFile::transformClass, the ClassFile. controls how the constant pool builder
of the resulting class is created.
class file building and constant pool building, some constant pool
entries supplied may be alien
to this constant pool builder of the active class file builder. For example,
classEntry(Utf8Entry) may be called with an
alien UTF8 entry. Alien entries will be converted to a pool entry in
this constant pool builder, reusing equivalent entries or adding new entries
if there is none. As a result, all pool entries returned by entry-bearing
methods in this constant pool builder belong to this constant pool.
Some ClassFileBuilder methods may have their outputs adjusted if they
receive pool entries alien to their constant pools. For example, if an ldc_w instruction with an alien entry is written to a CodeBuilder,
the CodeBuilder may emit a functionally equivalent ldc
instruction instead, if the converted entry can be encoded in such an
instruction.
To avoid the conversion of alien constant pool entries, such as for the
accuracy of the generated class file, users can always supply
constant pool entries obtained by calling the constant pool builder
entry-bearing methods of the constant pools associated with the ClassFileBuilder. Otherwise, the conversions have no impact on the
behaviors of the generated class files.
ClassFileBuilder#constantPool()
| Modifier and Type | Method and Description |
|---|---|
| public default BootstrapMethodEntry | Returns: aBootstrapMethodEntry describing the provided
bootstrap method and argumentsthe bootstrap method methodReference, List<ConstantDesc> the arguments arguments)Returns a |
| public BootstrapMethodEntry | Returns: aBootstrapMethodEntry referring to a MethodHandleEntry and a list of LoadableConstantEntrythe methodReference, List<LoadableConstantEntry> MethodHandleEntrythe list of arguments)LoadableConstantEntryReturns a |
| public boolean | Returns: true if the index of any entry in the given constant
pool refers to the same entry in this builderthe given constant pool constantPool)Returns |
| public ClassEntry | |
| public default ClassEntry | classEntry(ClassDesc
the symbolic descriptor for the reference type classDesc)Returns a |
| public default ConstantDynamicEntry | constantDynamicEntry(DynamicConstantDesc<?>
the symbolic descriptor of the constant dcd)Returns a |
| public ConstantDynamicEntry | constantDynamicEntry(BootstrapMethodEntry
the bootstrapMethodEntry, NameAndTypeEntry BootstrapMethodEntrythe nameAndType)NameAndTypeEntryReturns a |
| public default ConstantValueEntry | constantValueEntry(ConstantDesc
the provided constant value c)Returns a |
| public DoubleEntry | Returns: aDoubleEntry describing the provided valuethe value value)Returns a |
| public FieldRefEntry | fieldRefEntry(ClassEntry
the owner, NameAndTypeEntry ClassEntrythe nameAndType)NameAndTypeEntryReturns a |
| public default FieldRefEntry | Returns: aFieldRefEntry describing a field of a classthe class or interface the field is a member of owner, String the unqualified name of the field name, ClassDesc the field descriptor type)Returns a |
| public FloatEntry | Returns: aFloatEntry describing the provided valuethe value value)Returns a |
| public IntegerEntry | Returns: anIntegerEntry describing the provided valuethe value value)Returns an |
| public InterfaceMethodRefEntry | interfaceMethodRefEntry(ClassEntry
the owner, NameAndTypeEntry ClassEntrythe nameAndType)NameAndTypeEntryReturns an |
| public default InterfaceMethodRefEntry | Returns: anInterfaceMethodRefEntry describing a method of an
interfacethe interface the method is a member of owner, String the unqualified name of the method name, MethodTypeDesc the method descriptor type)Returns an |
| public default InvokeDynamicEntry | Returns: anInvokeDynamicEntry describing the same dynamic call
site as the provided DynamicCallSiteDescthe symbolic descriptor of the dynamic call site dcsd)Returns an |
| public InvokeDynamicEntry | invokeDynamicEntry(BootstrapMethodEntry
the bootstrapMethodEntry, NameAndTypeEntry BootstrapMethodEntrythe nameAndType)NameAndTypeEntryReturns an |
| public default LoadableConstantEntry | Returns: aLoadableConstantEntry describing the provided constant
valuethe nominal descriptor for the constant c)Returns a |
| public LongEntry | |
| public default MethodHandleEntry | methodHandleEntry(DirectMethodHandleDesc
the symbolic descriptor of the method handle descriptor)Returns a |
| public MethodHandleEntry | methodHandleEntry(int
the reference kind of the method handle refKind, MemberRefEntry the reference)MemberRefEntryReturns a |
| public MethodRefEntry | methodRefEntry(ClassEntry
the owner, NameAndTypeEntry ClassEntrythe nameAndType)NameAndTypeEntryReturns a |
| public default MethodRefEntry | Returns: aMethodRefEntry describing a method of a classthe class the method is a member of owner, String the unqualified name, or special name <init>, of the method name, MethodTypeDesc the method descriptor type)Returns a |
| public MethodTypeEntry | methodTypeEntry(MethodTypeDesc
the symbolic descriptor of the method type descriptor)Returns a |
| public MethodTypeEntry | methodTypeEntry(Utf8Entry
the descriptor)Utf8EntryReturns a |
| public ModuleEntry | moduleEntry(Utf8Entry
the constant pool entry describing the module name moduleName)Returns a |
| public default ModuleEntry | moduleEntry(ModuleDesc
the symbolic descriptor for the module moduleDesc)Returns a |
| public NameAndTypeEntry | nameAndTypeEntry(Utf8Entry
the name nameEntry, Utf8Entry Utf8Entrythe type typeEntry)Utf8EntryReturns a |
| public default NameAndTypeEntry | Returns: aNameAndTypeEntry describing the provided unqualified
name and field descriptorthe unqualified name name, ClassDesc the field descriptor type)Returns a |
| public default NameAndTypeEntry | Returns: aNameAndTypeEntry describing the provided name and
method descriptorthe unqualified name, or <init> name, MethodTypeDesc the method descriptor type)Returns a |
| public static ConstantPoolBuilder | Returns: a new constant pool builderthe class to copy from classModel)Returns a new constant pool builder. |
| public static ConstantPoolBuilder | |
| public PackageEntry | packageEntry(Utf8Entry
the nameEntry)Utf8EntryReturns a |
| public default PackageEntry | packageEntry(PackageDesc
the symbolic descriptor for the package packageDesc)Returns a |
| public StringEntry | |
| public default StringEntry | Returns: aStringEntry describing the provided valuethe value value)Returns a |
| public Utf8Entry | |
| public default Utf8Entry | utf8Entry(ClassDesc
the symbolic descriptor for the class desc)Returns a |
| public default Utf8Entry | utf8Entry(MethodTypeDesc
the symbolic descriptor for the method type desc)Returns a |
| bsmEntry | back to summary |
|---|---|
| public default BootstrapMethodEntry bsmEntry(DirectMethodHandleDesc methodReference, List<ConstantDesc> arguments) Returns a
| |
| bsmEntry | back to summary |
|---|---|
| public BootstrapMethodEntry bsmEntry(MethodHandleEntry methodReference, List<LoadableConstantEntry> arguments) Returns a
| |
| canWriteDirect | back to summary |
|---|---|
| public boolean canWriteDirect(ConstantPool constantPool) Returns
If the constant pool of an entry is not directly writable to this pool,
it is alien to this pool, and a
| |
| classEntry | back to summary |
|---|---|
| public ClassEntry classEntry(Utf8Entry ne) Returns a
| |
| classEntry | back to summary |
|---|---|
| public default ClassEntry classEntry(ClassDesc classDesc) Returns a
| |
| constantDynamicEntry | back to summary |
|---|---|
| public default ConstantDynamicEntry constantDynamicEntry(DynamicConstantDesc<?> dcd) Returns a
| |
| constantDynamicEntry | back to summary |
|---|---|
| public ConstantDynamicEntry constantDynamicEntry(BootstrapMethodEntry bootstrapMethodEntry, NameAndTypeEntry nameAndType) Returns a
| |
| constantValueEntry | back to summary |
|---|---|
| public default ConstantValueEntry constantValueEntry(ConstantDesc c) Returns a
| |
| doubleEntry | back to summary |
|---|---|
| public DoubleEntry doubleEntry(double value) Returns a
All NaN values of the
| |
| fieldRefEntry | back to summary |
|---|---|
| public FieldRefEntry fieldRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType) Returns a
| |
| fieldRefEntry | back to summary |
|---|---|
| public default FieldRefEntry fieldRefEntry(ClassDesc owner, String name, ClassDesc type) Returns a
| |
| floatEntry | back to summary |
|---|---|
| public FloatEntry floatEntry(float value) Returns a
All NaN values of the
| |
| intEntry | back to summary |
|---|---|
| public IntegerEntry intEntry(int value) Returns an
| |
| interfaceMethodRefEntry | back to summary |
|---|---|
| public InterfaceMethodRefEntry interfaceMethodRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType) Returns an
| |
| interfaceMethodRefEntry | back to summary |
|---|---|
| public default InterfaceMethodRefEntry interfaceMethodRefEntry(ClassDesc owner, String name, MethodTypeDesc type) Returns an
| |
| invokeDynamicEntry | back to summary |
|---|---|
| public default InvokeDynamicEntry invokeDynamicEntry(DynamicCallSiteDesc dcsd) Returns an
| |
| invokeDynamicEntry | back to summary |
|---|---|
| public InvokeDynamicEntry invokeDynamicEntry(BootstrapMethodEntry bootstrapMethodEntry, NameAndTypeEntry nameAndType) Returns an
| |
| loadableConstantEntry | back to summary |
|---|---|
| public default LoadableConstantEntry loadableConstantEntry(ConstantDesc c) Returns a
| |
| longEntry | back to summary |
|---|---|
| public LongEntry longEntry(long value) Returns a
| |
| methodHandleEntry | back to summary |
|---|---|
| public default MethodHandleEntry methodHandleEntry(DirectMethodHandleDesc descriptor) Returns a
| |
| methodHandleEntry | back to summary |
|---|---|
| public MethodHandleEntry methodHandleEntry(int refKind, MemberRefEntry reference) Returns a
| |
| methodRefEntry | back to summary |
|---|---|
| public MethodRefEntry methodRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType) Returns a
| |
| methodRefEntry | back to summary |
|---|---|
| public default MethodRefEntry methodRefEntry(ClassDesc owner, String name, MethodTypeDesc type) Returns a
| |
| methodTypeEntry | back to summary |
|---|---|
| public MethodTypeEntry methodTypeEntry(MethodTypeDesc descriptor) Returns a
| |
| methodTypeEntry | back to summary |
|---|---|
| public MethodTypeEntry methodTypeEntry(Utf8Entry descriptor) Returns a
| |
| moduleEntry | back to summary |
|---|---|
| public ModuleEntry moduleEntry(Utf8Entry moduleName) Returns a
| |
| moduleEntry | back to summary |
|---|---|
| public default ModuleEntry moduleEntry(ModuleDesc moduleDesc) Returns a
| |
| nameAndTypeEntry | back to summary |
|---|---|
| public NameAndTypeEntry nameAndTypeEntry(Utf8Entry nameEntry, Utf8Entry typeEntry) Returns a
| |
| nameAndTypeEntry | back to summary |
|---|---|
| public default NameAndTypeEntry nameAndTypeEntry(String name, ClassDesc type) Returns a
| |
| nameAndTypeEntry | back to summary |
|---|---|
| public default NameAndTypeEntry nameAndTypeEntry(String name, MethodTypeDesc type) Returns a
| |
| of | back to summary |
|---|---|
| public static ConstantPoolBuilder of(ClassModel classModel) Returns a new constant pool builder. The new constant pool builder will
be pre-populated with the contents of the constant pool associated with the given class model. The
index of new entries will start from the
| |
| of | back to summary |
|---|---|
| public static ConstantPoolBuilder of() Returns a new constant pool builder. The new constant pool builder
will be empty. The index of new entries will start from
| |
| packageEntry | back to summary |
|---|---|
| public PackageEntry packageEntry(Utf8Entry nameEntry) Returns a
| |
| packageEntry | back to summary |
|---|---|
| public default PackageEntry packageEntry(PackageDesc packageDesc) Returns a
| |
| stringEntry | back to summary |
|---|---|
| public StringEntry stringEntry(Utf8Entry utf8) Returns a
| |
| stringEntry | back to summary |
|---|---|
| public default StringEntry stringEntry(String value) Returns a
| |
| utf8Entry | back to summary |
|---|---|
| public Utf8Entry utf8Entry(String s) Returns a
| |
| utf8Entry | back to summary |
|---|---|
| public default Utf8Entry utf8Entry(ClassDesc desc) Returns a API Note The resulting
| |
| utf8Entry | back to summary |
|---|---|
| public default Utf8Entry utf8Entry(MethodTypeDesc desc) Returns a
| |