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

public sealed Interface ConstantPoolBuilder

extends ConstantPool
permits SplitConstantPool, TemporaryConstantPool
Known Direct Implementers
jdk.internal.classfile.impl.SplitConstantPool, jdk.internal.classfile.impl.TemporaryConstantPool
Imports
java.lang.classfile.BootstrapMethodEntry, .ClassFile, .ClassFileBuilder, .ClassModel, .CodeBuilder, java.lang.classfile.attribute.ConstantValueAttribute, java.lang.classfile.instruction.ConstantInstruction, java.lang.constant.*, java.lang.invoke.MethodHandleInfo, java.util.List, java.util.function.Consumer, jdk.internal.classfile.impl.AbstractPoolEntry, .AbstractPoolEntry.ClassEntryImpl, .ClassReaderImpl, .SplitConstantPool, .TemporaryConstantPool, .Util

Builder for the constant pool of a 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.ConstantPoolSharingOption controls how the constant pool builder of the resulting class is created.

Alien Constant Pool Entries

In 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.

Since
24
See Also
ClassFileBuilder#constantPool()

Method Summary

Modifier and TypeMethod and Description
public default BootstrapMethodEntry

Returns:

a BootstrapMethodEntry describing the provided bootstrap method and arguments
bsmEntry
(DirectMethodHandleDesc
the bootstrap method
methodReference
,
List<ConstantDesc>
the arguments
arguments
)

Returns a BootstrapMethodEntry describing the provided bootstrap method and arguments.

public BootstrapMethodEntry

Returns:

a BootstrapMethodEntry referring to a MethodHandleEntry and a list of LoadableConstantEntry
bsmEntry
(MethodHandleEntry
the MethodHandleEntry
methodReference
,
List<LoadableConstantEntry>
the list of LoadableConstantEntry
arguments
)

Returns a BootstrapMethodEntry referring to a MethodHandleEntry and a list of LoadableConstantEntry.

public boolean

Returns:

true if the index of any entry in the given constant pool refers to the same entry in this builder
canWriteDirect
(ConstantPool
the given constant pool
constantPool
)

Returns true if the index of any entry in the given constant pool refers to the same entry in this builder.

public ClassEntry

Returns:

a ClassEntry referring to the provided Utf8Entry
classEntry
(Utf8Entry
the Utf8Entry
ne
)

Returns a ClassEntry referring to the provided Utf8Entry.

public default ClassEntry

Returns:

a ClassEntry describing the same reference type as the provided ClassDesc
classEntry
(ClassDesc
the symbolic descriptor for the reference type
classDesc
)

Returns a ClassEntry describing the same reference type as the provided ClassDesc.

public default ConstantDynamicEntry

Returns:

a ConstantDynamicEntry describing the dynamic constant as the provided DynamicConstantDesc
constantDynamicEntry
(DynamicConstantDesc<?>
the symbolic descriptor of the constant
dcd
)

Returns a ConstantDynamicEntry describing the dynamic constant as the provided DynamicConstantDesc.

public ConstantDynamicEntry
constantDynamicEntry(BootstrapMethodEntry
the BootstrapMethodEntry
bootstrapMethodEntry
,
NameAndTypeEntry
the NameAndTypeEntry
nameAndType
)

Returns a ConstantDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry.

public default ConstantValueEntry

Returns:

a ConstantValueEntry describing the provided constant Integer, Long, Float, Double, or String value
constantValueEntry
(ConstantDesc
the provided constant value
c
)

Returns a ConstantValueEntry describing the provided constant Integer, Long, Float, Double, or String value.

public DoubleEntry

Returns:

a DoubleEntry describing the provided value
doubleEntry
(double
the value
value
)

Returns a DoubleEntry describing the provided value.

public FieldRefEntry

Returns:

a FieldRefEntry referring to a ClassEntry and a NameAndTypeEntry
fieldRefEntry
(ClassEntry
the ClassEntry
owner
,
NameAndTypeEntry
the NameAndTypeEntry
nameAndType
)

Returns a FieldRefEntry referring to a ClassEntry and a NameAndTypeEntry.

public default FieldRefEntry

Returns:

a FieldRefEntry describing a field of a class
fieldRefEntry
(ClassDesc
the 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 FieldRefEntry describing a field of a class.

public FloatEntry

Returns:

a FloatEntry describing the provided value
floatEntry
(float
the value
value
)

Returns a FloatEntry describing the provided value.

public IntegerEntry

Returns:

an IntegerEntry describing the provided value
intEntry
(int
the value
value
)

Returns an IntegerEntry describing the provided value.

public InterfaceMethodRefEntry

Returns:

an InterfaceMethodRefEntry referring to a ClassEntry and a NameAndTypeEntry
interfaceMethodRefEntry
(ClassEntry
the ClassEntry
owner
,
NameAndTypeEntry
the NameAndTypeEntry
nameAndType
)

Returns an InterfaceMethodRefEntry referring to a ClassEntry and a NameAndTypeEntry.

public default InterfaceMethodRefEntry

Returns:

an InterfaceMethodRefEntry describing a method of an interface
interfaceMethodRefEntry
(ClassDesc
the interface the method is a member of
owner
,
String
the unqualified name of the method
name
,
MethodTypeDesc
the method descriptor
type
)

Returns an InterfaceMethodRefEntry describing a method of an interface.

public default InvokeDynamicEntry

Returns:

an InvokeDynamicEntry describing the same dynamic call site as the provided DynamicCallSiteDesc
invokeDynamicEntry
(DynamicCallSiteDesc
the symbolic descriptor of the dynamic call site
dcsd
)

Returns an InvokeDynamicEntry describing the same dynamic call site as the provided DynamicCallSiteDesc.

public InvokeDynamicEntry
invokeDynamicEntry(BootstrapMethodEntry
the BootstrapMethodEntry
bootstrapMethodEntry
,
NameAndTypeEntry
the NameAndTypeEntry
nameAndType
)

Returns an InvokeDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry.

public default LoadableConstantEntry

Returns:

a LoadableConstantEntry describing the provided constant value
loadableConstantEntry
(ConstantDesc
the nominal descriptor for the constant
c
)

Returns a LoadableConstantEntry describing the provided constant value.

public LongEntry

Returns:

a LongEntry describing the provided value
longEntry
(long
the value
value
)

Returns a LongEntry describing the provided value.

public default MethodHandleEntry

Returns:

a MethodHandleEntry describing the same method handle as the given DirectMethodHandleDesc
methodHandleEntry
(DirectMethodHandleDesc
the symbolic descriptor of the method handle
descriptor
)

Returns a MethodHandleEntry describing the same method handle as the given DirectMethodHandleDesc.

public MethodHandleEntry

Returns:

a MethodHandleEntry encoding a reference kind and referring to a MemberRefEntry
methodHandleEntry
(int
the reference kind of the method handle
refKind
,
MemberRefEntry
the MemberRefEntry
reference
)

Returns a MethodHandleEntry encoding a reference kind and referring to a MemberRefEntry.

public MethodRefEntry

Returns:

a MethodRefEntry referring to a ClassEntry and a NameAndTypeEntry
methodRefEntry
(ClassEntry
the ClassEntry
owner
,
NameAndTypeEntry
the NameAndTypeEntry
nameAndType
)

Returns a MethodRefEntry referring to a ClassEntry and a NameAndTypeEntry.

public default MethodRefEntry

Returns:

a MethodRefEntry describing a method of a class
methodRefEntry
(ClassDesc
the 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 MethodRefEntry describing a method of a class.

public MethodTypeEntry

Returns:

a MethodTypeEntry describing the same method type as the provided MethodTypeDesc
methodTypeEntry
(MethodTypeDesc
the symbolic descriptor of the method type
descriptor
)

Returns a MethodTypeEntry describing the same method type as the provided MethodTypeDesc.

public MethodTypeEntry

Returns:

a MethodTypeEntry referring to a Utf8Entry
methodTypeEntry
(Utf8Entry
the Utf8Entry
descriptor
)

Returns a MethodTypeEntry referring to a Utf8Entry.

public ModuleEntry

Returns:

a ModuleEntry referring to the provided Utf8Entry
moduleEntry
(Utf8Entry
the constant pool entry describing the module name
moduleName
)

Returns a ModuleEntry referring to the provided Utf8Entry.

public default ModuleEntry

Returns:

a ModuleEntry describing the same module as the provided ModuleDesc
moduleEntry
(ModuleDesc
the symbolic descriptor for the module
moduleDesc
)

Returns a ModuleEntry describing the same module as the provided ModuleDesc.

public NameAndTypeEntry

Returns:

a NameAndTypeEntry referring to the provided name and type Utf8Entry
nameAndTypeEntry
(Utf8Entry
the name Utf8Entry
nameEntry
,
Utf8Entry
the type Utf8Entry
typeEntry
)

Returns a NameAndTypeEntry referring to the provided name and type Utf8Entry.

public default NameAndTypeEntry

Returns:

a NameAndTypeEntry describing the provided unqualified name and field descriptor
nameAndTypeEntry
(String
the unqualified name
name
,
ClassDesc
the field descriptor
type
)

Returns a NameAndTypeEntry describing the provided unqualified name and field descriptor.

public default NameAndTypeEntry

Returns:

a NameAndTypeEntry describing the provided name and method descriptor
nameAndTypeEntry
(String
the unqualified name, or <init>
name
,
MethodTypeDesc
the method descriptor
type
)

Returns a NameAndTypeEntry describing the provided name and method descriptor.

public static ConstantPoolBuilder

Returns:

a new constant pool builder
of
(ClassModel
the class to copy from
classModel
)

Returns a new constant pool builder.

public static ConstantPoolBuilder

Returns:

a new constant pool builder
of
()

Returns a new constant pool builder.

public PackageEntry

Returns:

a PackageEntry referring to the provided Utf8Entry
packageEntry
(Utf8Entry
the Utf8Entry
nameEntry
)

Returns a PackageEntry referring to the provided Utf8Entry.

public default PackageEntry

Returns:

a PackageEntry describing the same package as the provided PackageDesc
packageEntry
(PackageDesc
the symbolic descriptor for the package
packageDesc
)

Returns a PackageEntry describing the same package as the provided PackageDesc.

public StringEntry

Returns:

a StringEntry referring to a Utf8Entry
stringEntry
(Utf8Entry
the Utf8Entry
utf8
)

Returns a StringEntry referring to a Utf8Entry.

public default StringEntry

Returns:

a StringEntry describing the provided value
stringEntry
(String
the value
value
)

Returns a StringEntry describing the provided value.

public Utf8Entry

Returns:

a Utf8Entry describing the provided String
utf8Entry
(String
the string
s
)

Returns a Utf8Entry describing the provided String.

public default Utf8Entry

Returns:

a Utf8Entry describing the field descriptor string of the provided ClassDesc
utf8Entry
(ClassDesc
the symbolic descriptor for the class
desc
)

Returns a Utf8Entry describing the field descriptor string of the provided ClassDesc.

public default Utf8Entry

Returns:

a Utf8Entry describing the method descriptor string of the provided MethodTypeDesc
utf8Entry
(MethodTypeDesc
the symbolic descriptor for the method type
desc
)

Returns a Utf8Entry describing the method descriptor string of the provided MethodTypeDesc.

Inherited from java.lang.classfile.constantpool.ConstantPool:
bootstrapMethodCountbootstrapMethodEntryentryByIndexentryByIndexiteratorsize

Method Detail

bsmEntryback to summary
public default BootstrapMethodEntry bsmEntry(DirectMethodHandleDesc methodReference, List<ConstantDesc> arguments)

Returns a BootstrapMethodEntry describing the provided bootstrap method and arguments.

Parameters
methodReference:DirectMethodHandleDesc

the bootstrap method

arguments:List<ConstantDesc>

the arguments

Returns:BootstrapMethodEntry

a BootstrapMethodEntry describing the provided bootstrap method and arguments

Exceptions
IllegalArgumentException:
if the number of arguments exceeds the limit of u2
bsmEntryback to summary
public BootstrapMethodEntry bsmEntry(MethodHandleEntry methodReference, List<LoadableConstantEntry> arguments)

Returns a BootstrapMethodEntry referring to a MethodHandleEntry and a list of LoadableConstantEntry. The MethodHandleEntry is the bootstrap method, and the list of LoadableConstantEntry is the arguments.

Parameters
methodReference:MethodHandleEntry

the MethodHandleEntry

arguments:List<LoadableConstantEntry>

the list of LoadableConstantEntry

Returns:BootstrapMethodEntry

a BootstrapMethodEntry referring to a MethodHandleEntry and a list of LoadableConstantEntry

Exceptions
IllegalArgumentException:
if the number of arguments exceeds the limit of u2
See Also
BootstrapMethodEntry::bootstrapMethod, BootstrapMethodEntry::arguments
canWriteDirectback to summary
public boolean canWriteDirect(ConstantPool constantPool)

Returns true if the index of any entry in the given constant pool refers to the same entry in this builder. This may be because they are the same builder, or because this builder was pre-populated from the given constant pool.

If the constant pool of an entry is not directly writable to this pool, it is alien to this pool, and a ClassFileBuilder associated with this constant pool will convert that alien constant pool entry.

Parameters
constantPool:ConstantPool

the given constant pool

Returns:boolean

true if the index of any entry in the given constant pool refers to the same entry in this builder

See Also
ClassFileBuilder::constantPool, Alien Constant Pool Entries
classEntryback to summary
public ClassEntry classEntry(Utf8Entry ne)

Returns a ClassEntry referring to the provided Utf8Entry. The Utf8Entry describes the internal form of the binary name of a class or interface or the field descriptor string of an array type.

Parameters
ne:Utf8Entry

the Utf8Entry

Returns:ClassEntry

a ClassEntry referring to the provided Utf8Entry

See Also
ClassEntry::name
classEntryback to summary
public default ClassEntry classEntry(ClassDesc classDesc)

Returns a ClassEntry describing the same reference type as the provided ClassDesc.

Parameters
classDesc:ClassDesc

the symbolic descriptor for the reference type

Returns:ClassEntry

a ClassEntry describing the same reference type as the provided ClassDesc

Exceptions
IllegalArgumentException:
if classDesc represents a primitive type
See Also
ClassEntry::asSymbol
constantDynamicEntryback to summary
public default ConstantDynamicEntry constantDynamicEntry(DynamicConstantDesc<?> dcd)

Returns a ConstantDynamicEntry describing the dynamic constant as the provided DynamicConstantDesc.

Parameters
dcd:DynamicConstantDesc<?>

the symbolic descriptor of the constant

Returns:ConstantDynamicEntry

a ConstantDynamicEntry describing the dynamic constant as the provided DynamicConstantDesc

See Also
ConstantDynamicEntry::asSymbol
constantDynamicEntryback to summary
public ConstantDynamicEntry constantDynamicEntry(BootstrapMethodEntry bootstrapMethodEntry, NameAndTypeEntry nameAndType)

Returns a ConstantDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry. The BootstrapMethodEntry describes the bootstrap method and its invocation arguments in addition to the name and type, and the NameAndTypeEntry a name and a field descriptor.

Parameters
bootstrapMethodEntry:BootstrapMethodEntry

the BootstrapMethodEntry

nameAndType:NameAndTypeEntry

the NameAndTypeEntry

Returns:ConstantDynamicEntry

a ConstantDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry

See Also
ConstantDynamicEntry::bootstrap, ConstantDynamicEntry::nameAndType
constantValueEntryback to summary
public default ConstantValueEntry constantValueEntry(ConstantDesc c)

Returns a ConstantValueEntry describing the provided constant Integer, Long, Float, Double, or String value.

Parameters
c:ConstantDesc

the provided constant value

Returns:ConstantValueEntry

a ConstantValueEntry describing the provided constant Integer, Long, Float, Double, or String value

Exceptions
IllegalArgumentException:
if the value is not one of Integer, Long, Float, Double, or String
See Also
ConstantValueEntry::constantValue, ConstantValueAttribute::of(ConstantDesc)
doubleEntryback to summary
public DoubleEntry doubleEntry(double value)

Returns a DoubleEntry describing the provided value.

All NaN values of the double may or may not be collapsed into a single "canonical" NaN value.

Parameters
value:double

the value

Returns:DoubleEntry

a DoubleEntry describing the provided value

See Also
DoubleEntry::doubleValue
fieldRefEntryback to summary
public FieldRefEntry fieldRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType)

Returns a FieldRefEntry referring to a ClassEntry and a NameAndTypeEntry. The ClassEntry describes a class or interface that has this field as a member, and the NameAndTypeEntry describes the unqualified name and the field descriptor for this field.

Parameters
owner:ClassEntry

the ClassEntry

nameAndType:NameAndTypeEntry

the NameAndTypeEntry

Returns:FieldRefEntry

a FieldRefEntry referring to a ClassEntry and a NameAndTypeEntry

See Also
FieldRefEntry::owner, FieldRefEntry::nameAndType
fieldRefEntryback to summary
public default FieldRefEntry fieldRefEntry(ClassDesc owner, String name, ClassDesc type)

Returns a FieldRefEntry describing a field of a class.

Parameters
owner:ClassDesc

the class or interface the field is a member of

name:String

the unqualified name of the field

type:ClassDesc

the field descriptor

Returns:FieldRefEntry

a FieldRefEntry describing a field of a class

Exceptions
IllegalArgumentException:
if owner represents a primitive type
See Also
FieldRefEntry::typeSymbol
floatEntryback to summary
public FloatEntry floatEntry(float value)

Returns a FloatEntry describing the provided value.

All NaN values of the float may or may not be collapsed into a single "canonical" NaN value.

Parameters
value:float

the value

Returns:FloatEntry

a FloatEntry describing the provided value

See Also
FloatEntry::floatValue
intEntryback to summary
public IntegerEntry intEntry(int value)

Returns an IntegerEntry describing the provided value.

Parameters
value:int

the value

Returns:IntegerEntry

an IntegerEntry describing the provided value

See Also
IntegerEntry::intValue
interfaceMethodRefEntryback to summary
public InterfaceMethodRefEntry interfaceMethodRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType)

Returns an InterfaceMethodRefEntry referring to a ClassEntry and a NameAndTypeEntry. The ClassEntry describes an interface that has this method as a member, and the NameAndTypeEntry describes the unqualified name and the method descriptor for this method.

Parameters
owner:ClassEntry

the ClassEntry

nameAndType:NameAndTypeEntry

the NameAndTypeEntry

Returns:InterfaceMethodRefEntry

an InterfaceMethodRefEntry referring to a ClassEntry and a NameAndTypeEntry

See Also
InterfaceMethodRefEntry::owner, InterfaceMethodRefEntry::nameAndType
interfaceMethodRefEntryback to summary
public default InterfaceMethodRefEntry interfaceMethodRefEntry(ClassDesc owner, String name, MethodTypeDesc type)

Returns an InterfaceMethodRefEntry describing a method of an interface.

Parameters
owner:ClassDesc

the interface the method is a member of

name:String

the unqualified name of the method

type:MethodTypeDesc

the method descriptor

Returns:InterfaceMethodRefEntry

an InterfaceMethodRefEntry describing a method of an interface

Exceptions
IllegalArgumentException:
if owner represents a primitive type
See Also
InterfaceMethodRefEntry::typeSymbol
invokeDynamicEntryback to summary
public default InvokeDynamicEntry invokeDynamicEntry(DynamicCallSiteDesc dcsd)

Returns an InvokeDynamicEntry describing the same dynamic call site as the provided DynamicCallSiteDesc.

Parameters
dcsd:DynamicCallSiteDesc

the symbolic descriptor of the dynamic call site

Returns:InvokeDynamicEntry

an InvokeDynamicEntry describing the same dynamic call site as the provided DynamicCallSiteDesc

See Also
InvokeDynamicEntry::asSymbol
invokeDynamicEntryback to summary
public InvokeDynamicEntry invokeDynamicEntry(BootstrapMethodEntry bootstrapMethodEntry, NameAndTypeEntry nameAndType)

Returns an InvokeDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry. The BootstrapMethodEntry describes the bootstrap method and its invocation arguments in addition to the name and type, and the NameAndTypeEntry a name and a method descriptor.

Parameters
bootstrapMethodEntry:BootstrapMethodEntry

the BootstrapMethodEntry

nameAndType:NameAndTypeEntry

the NameAndTypeEntry

Returns:InvokeDynamicEntry

an InvokeDynamicEntry referring to a BootstrapMethodEntry and a NameAndTypeEntry

See Also
InvokeDynamicEntry::bootstrap, InvokeDynamicEntry::nameAndType
loadableConstantEntryback to summary
public default LoadableConstantEntry loadableConstantEntry(ConstantDesc c)

Returns a LoadableConstantEntry describing the provided constant value.

Parameters
c:ConstantDesc

the nominal descriptor for the constant

Returns:LoadableConstantEntry

a LoadableConstantEntry describing the provided constant value

longEntryback to summary
public LongEntry longEntry(long value)

Returns a LongEntry describing the provided value.

Parameters
value:long

the value

Returns:LongEntry

a LongEntry describing the provided value

See Also
LongEntry::longValue
methodHandleEntryback to summary
public default MethodHandleEntry methodHandleEntry(DirectMethodHandleDesc descriptor)

Returns a MethodHandleEntry describing the same method handle as the given DirectMethodHandleDesc.

Parameters
descriptor:DirectMethodHandleDesc

the symbolic descriptor of the method handle

Returns:MethodHandleEntry

a MethodHandleEntry describing the same method handle as the given DirectMethodHandleDesc

See Also
MethodHandleEntry::asSymbol
methodHandleEntryback to summary
public MethodHandleEntry methodHandleEntry(int refKind, MemberRefEntry reference)

Returns a MethodHandleEntry encoding a reference kind and referring to a MemberRefEntry. The reference kind is in [1, 9], and the MemberRefEntry is subject to various restrictions based on the reference kind (JVMS 4.4.8).

Parameters
refKind:int

the reference kind of the method handle

reference:MemberRefEntry

the MemberRefEntry

Returns:MethodHandleEntry

a MethodHandleEntry encoding a reference kind and referring to a MemberRefEntry

Exceptions
IllegalArgumentException:
if refKind is not u1
See Also
Reference kinds, MethodHandleEntry::kind, MethodHandleEntry::reference
methodRefEntryback to summary
public MethodRefEntry methodRefEntry(ClassEntry owner, NameAndTypeEntry nameAndType)

Returns a MethodRefEntry referring to a ClassEntry and a NameAndTypeEntry. The ClassEntry describes a class that has this method as a member, and the NameAndTypeEntry describes the unqualified name or the special name <init> and the method descriptor for this method.

Parameters
owner:ClassEntry

the ClassEntry

nameAndType:NameAndTypeEntry

the NameAndTypeEntry

Returns:MethodRefEntry

a MethodRefEntry referring to a ClassEntry and a NameAndTypeEntry

See Also
MethodRefEntry::owner, MethodRefEntry::nameAndType
methodRefEntryback to summary
public default MethodRefEntry methodRefEntry(ClassDesc owner, String name, MethodTypeDesc type)

Returns a MethodRefEntry describing a method of a class.

Parameters
owner:ClassDesc

the class the method is a member of

name:String

the unqualified name, or special name <init>, of the method

type:MethodTypeDesc

the method descriptor

Returns:MethodRefEntry

a MethodRefEntry describing a method of a class

Exceptions
IllegalArgumentException:
if owner represents a primitive type
See Also
MethodRefEntry::typeSymbol
methodTypeEntryback to summary
public MethodTypeEntry methodTypeEntry(MethodTypeDesc descriptor)

Returns a MethodTypeEntry describing the same method type as the provided MethodTypeDesc.

Parameters
descriptor:MethodTypeDesc

the symbolic descriptor of the method type

Returns:MethodTypeEntry

a MethodTypeEntry describing the same method type as the provided MethodTypeDesc

See Also
MethodTypeEntry::asSymbol
methodTypeEntryback to summary
public MethodTypeEntry methodTypeEntry(Utf8Entry descriptor)

Returns a MethodTypeEntry referring to a Utf8Entry. The Utf8Entry represents a method descriptor string.

Parameters
descriptor:Utf8Entry

the Utf8Entry

Returns:MethodTypeEntry

a MethodTypeEntry referring to a Utf8Entry

See Also
MethodTypeEntry::descriptor
moduleEntryback to summary
public ModuleEntry moduleEntry(Utf8Entry moduleName)

Returns a ModuleEntry referring to the provided Utf8Entry. The Utf8Entry describes the module name.

Parameters
moduleName:Utf8Entry

the constant pool entry describing the module name

Returns:ModuleEntry

a ModuleEntry referring to the provided Utf8Entry

See Also
ModuleEntry::name
moduleEntryback to summary
public default ModuleEntry moduleEntry(ModuleDesc moduleDesc)

Returns a ModuleEntry describing the same module as the provided ModuleDesc.

Parameters
moduleDesc:ModuleDesc

the symbolic descriptor for the module

Returns:ModuleEntry

a ModuleEntry describing the same module as the provided ModuleDesc

See Also
ModuleEntry::asSymbol
nameAndTypeEntryback to summary
public NameAndTypeEntry nameAndTypeEntry(Utf8Entry nameEntry, Utf8Entry typeEntry)

Returns a NameAndTypeEntry referring to the provided name and type Utf8Entry. The name Utf8Entry describes an unqualified name or the special name <init>, and the type Utf8Entry describes a field or method descriptor string.

Parameters
nameEntry:Utf8Entry

the name Utf8Entry

typeEntry:Utf8Entry

the type Utf8Entry

Returns:NameAndTypeEntry

a NameAndTypeEntry referring to the provided name and type Utf8Entry

See Also
NameAndTypeEntry::name, NameAndTypeEntry::type
nameAndTypeEntryback to summary
public default NameAndTypeEntry nameAndTypeEntry(String name, ClassDesc type)

Returns a NameAndTypeEntry describing the provided unqualified name and field descriptor.

Parameters
name:String

the unqualified name

type:ClassDesc

the field descriptor

Returns:NameAndTypeEntry

a NameAndTypeEntry describing the provided unqualified name and field descriptor

nameAndTypeEntryback to summary
public default NameAndTypeEntry nameAndTypeEntry(String name, MethodTypeDesc type)

Returns a NameAndTypeEntry describing the provided name and method descriptor. The name can be an unqualified name or the special name <init>.

Parameters
name:String

the unqualified name, or <init>

type:MethodTypeDesc

the method descriptor

Returns:NameAndTypeEntry

a NameAndTypeEntry describing the provided name and method descriptor

ofback 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 size() of the source pool.

Parameters
classModel:ClassModel

the class to copy from

Returns:ConstantPoolBuilder

a new constant pool builder

See Also
ClassFile#build(ClassEntry, ConstantPoolBuilder, Consumer), ClassFile.ConstantPoolSharingOption#SHARED_POOL
ofback 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 1.

Returns:ConstantPoolBuilder

a new constant pool builder

See Also
ClassFile.ConstantPoolSharingOption#NEW_POOL
packageEntryback to summary
public PackageEntry packageEntry(Utf8Entry nameEntry)

Returns a PackageEntry referring to the provided Utf8Entry. The Utf8Entry describes the internal form of the name of a package.

Parameters
nameEntry:Utf8Entry

the Utf8Entry

Returns:PackageEntry

a PackageEntry referring to the provided Utf8Entry

See Also
PackageEntry::name
packageEntryback to summary
public default PackageEntry packageEntry(PackageDesc packageDesc)

Returns a PackageEntry describing the same package as the provided PackageDesc.

Parameters
packageDesc:PackageDesc

the symbolic descriptor for the package

Returns:PackageEntry

a PackageEntry describing the same package as the provided PackageDesc

See Also
PackageEntry::asSymbol
stringEntryback to summary
public StringEntry stringEntry(Utf8Entry utf8)

Returns a StringEntry referring to a Utf8Entry. The Utf8Entry describes the string value.

Parameters
utf8:Utf8Entry

the Utf8Entry

Returns:StringEntry

a StringEntry referring to a Utf8Entry

See Also
StringEntry::utf8
stringEntryback to summary
public default StringEntry stringEntry(String value)

Returns a StringEntry describing the provided value.

Parameters
value:String

the value

Returns:StringEntry

a StringEntry describing the provided value

See Also
StringEntry::stringValue
utf8Entryback to summary
public Utf8Entry utf8Entry(String s)

Returns a Utf8Entry describing the provided String.

Parameters
s:String

the string

Returns:Utf8Entry

a Utf8Entry describing the provided String

See Also
Utf8Entry::stringValue
utf8Entryback to summary
public default Utf8Entry utf8Entry(ClassDesc desc)

Returns a Utf8Entry describing the field descriptor string of the provided ClassDesc.

API Note

The resulting Utf8Entry is usually not referable by a ClassEntry, which uses internal form of binary names.

Parameters
desc:ClassDesc

the symbolic descriptor for the class

Returns:Utf8Entry

a Utf8Entry describing the field descriptor string of the provided ClassDesc

utf8Entryback to summary
public default Utf8Entry utf8Entry(MethodTypeDesc desc)

Returns a Utf8Entry describing the method descriptor string of the provided MethodTypeDesc.

Parameters
desc:MethodTypeDesc

the symbolic descriptor for the method type

Returns:Utf8Entry

a Utf8Entry describing the method descriptor string of the provided MethodTypeDesc