Package javassist.bytecode
Class ConstPool
java.lang.Object
javassist.bytecode.ConstPool
Constant pool table.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
CONSTANT_Class
static final int
CONSTANT_Double
static final int
CONSTANT_Dynamic
static final int
CONSTANT_DynamicCallSite
, also known asCONSTANT_InvokeDynamic
static final int
CONSTANT_Fieldref
static final int
CONSTANT_Float
static final int
CONSTANT_Integer
static final int
CONSTANT_InterfaceMethodref
static final int
static final int
CONSTANT_Long
static final int
CONSTANT_MethodHandle
static final int
CONSTANT_Methodref
static final int
CONSTANT_MethodHandle
static final int
CONSTANT_Module
static final int
CONSTANT_NameAndType
static final int
CONSTANT_Package
static final int
CONSTANT_String
static final int
CONSTANT_Utf8
static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final int
reference_kind
ofCONSTANT_MethodHandle_info
.static final CtClass
Represents the class using this constant pool table. -
Constructor Summary
ConstructorDescriptionConstructs a constant pool table from the given byte stream.Constructs a constant pool table. -
Method Summary
Modifier and TypeMethodDescriptionint
addClassInfo
(String qname) Adds a newCONSTANT_Class_info
structure.int
Adds a newCONSTANT_Class_info
structure.int
addDoubleInfo
(double d) Adds a newCONSTANT_Double_info
structure.int
addDynamicInfo
(int bootstrap, int nameAndType) Adds a newCONSTANT_Dynamic_info
structure.int
addFieldrefInfo
(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_Fieldref_info
structure.int
addFieldrefInfo
(int classInfo, String name, String type) Adds a newCONSTANT_Fieldref_info
structure.int
addFloatInfo
(float f) Adds a newCONSTANT_Float_info
structure.int
addIntegerInfo
(int i) Adds a newCONSTANT_Integer_info
structure.int
addInterfaceMethodrefInfo
(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_InterfaceMethodref_info
structure.int
addInterfaceMethodrefInfo
(int classInfo, String name, String type) Adds a newCONSTANT_InterfaceMethodref_info
structure.int
addInvokeDynamicInfo
(int bootstrap, int nameAndType) Adds a newCONSTANT_InvokeDynamic_info
structure.int
addLongInfo
(long l) Adds a newCONSTANT_Long_info
structure.int
addMethodHandleInfo
(int kind, int index) Adds a newCONSTANT_MethodHandle_info
structure.int
addMethodrefInfo
(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_Methodref_info
structure.int
addMethodrefInfo
(int classInfo, String name, String type) Adds a newCONSTANT_Methodref_info
structure.int
addMethodTypeInfo
(int desc) Adds a newCONSTANT_MethodType_info
structure.int
addModuleInfo
(int nameIndex) Adds a newCONSTANT_Module_info
int
addNameAndTypeInfo
(int name, int type) Adds a newCONSTANT_NameAndType_info
structure.int
addNameAndTypeInfo
(String name, String type) Adds a newCONSTANT_NameAndType_info
structure.int
addPackageInfo
(int nameIndex) Adds a newCONSTANT_Package_info
int
addStringInfo
(String str) Adds a newCONSTANT_String_info
structure.int
addUtf8Info
(String utf8) Adds a newCONSTANT_Utf8_info
structure.int
Copies the n-th item in this ConstPool object into the destination ConstPool object.Determines whetherCONSTANT_Methodref_info
,CONSTANT_Fieldref_info
, orCONSTANT_InterfaceMethodref_info
structure at the given index has the name and the descriptor given as the arguments.getClassInfo
(int index) ReadsCONSTANT_Class_info
structure at the given index.getClassInfoByDescriptor
(int index) ReadsCONSTANT_Class_info
structure at the given index.Returns the name of the class using this constant pool table.Get all the class names.double
getDoubleInfo
(int index) ReadsCONSTANT_Double_info
structure at the given index.int
getDynamicBootstrap
(int index) Reads thebootstrap_method_attr_index
field of theCONSTANT_Dynamic_info
structure at the given index.int
getDynamicNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_Dynamic_info
structure at the given index.getDynamicType
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getFieldrefClass
(int index) Reads theclass_index
field of theCONSTANT_Fieldref_info
structure at the given index.getFieldrefClassName
(int index) Reads theclass_index
field of theCONSTANT_Fieldref_info
structure at the given index.getFieldrefName
(int index) Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getFieldrefNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_Fieldref_info
structure at the given index.getFieldrefType
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.float
getFloatInfo
(int index) ReadsCONSTANT_Float_info
structure at the given index.int
getIntegerInfo
(int index) ReadsCONSTANT_Integer_info
structure at the given index.int
getInterfaceMethodrefClass
(int index) Reads theclass_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index.getInterfaceMethodrefClassName
(int index) Reads theclass_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index.getInterfaceMethodrefName
(int index) Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getInterfaceMethodrefNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index.getInterfaceMethodrefType
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getInvokeDynamicBootstrap
(int index) Reads thebootstrap_method_attr_index
field of theCONSTANT_InvokeDynamic_info
structure at the given index.int
getInvokeDynamicNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_InvokeDynamic_info
structure at the given index.getInvokeDynamicType
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.getLdcValue
(int index) ReadsCONSTANT_Integer_info
,_Float_info
,_Long_info
,_Double_info
, or_String_info
structure.long
getLongInfo
(int index) ReadsCONSTANT_Long_info
structure at the given index.int
getMemberClass
(int index) Reads theclass_index
field of theCONSTANT_Fieldref_info
,CONSTANT_Methodref_info
, orCONSTANT_Interfaceref_info
, structure at the given index.int
getMemberNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_Fieldref_info
,CONSTANT_Methodref_info
, orCONSTANT_Interfaceref_info
, structure at the given index.int
getMethodHandleIndex
(int index) Reads thereference_index
field of theCONSTANT_MethodHandle_info
structure at the given index.int
getMethodHandleKind
(int index) Reads thereference_kind
field of theCONSTANT_MethodHandle_info
structure at the given index.int
getMethodrefClass
(int index) Reads theclass_index
field of theCONSTANT_Methodref_info
structure at the given index.getMethodrefClassName
(int index) Reads theclass_index
field of theCONSTANT_Methodref_info
structure at the given index.getMethodrefName
(int index) Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getMethodrefNameAndType
(int index) Reads thename_and_type_index
field of theCONSTANT_Methodref_info
structure at the given index.getMethodrefType
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.int
getMethodTypeInfo
(int index) Reads thedescriptor_index
field of theCONSTANT_MethodType_info
structure at the given index.getModuleInfo
(int index) Reads thename_index
field of theCONSTANT_Module_info
structure at the given index.int
getNameAndTypeDescriptor
(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure at the given index.int
getNameAndTypeName
(int index) Reads thename_index
field of theCONSTANT_NameAndType_info
structure at the given index.getPackageInfo
(int index) Reads thename_index
field of theCONSTANT_Package_info
structure at the given index.int
getSize()
Returns the number of entries in this table.getStringInfo
(int index) ReadsCONSTANT_String_info
structure at the given index.int
getTag
(int index) Returns thetag
field of the constant pool table entry at the given index.int
Returns the index ofCONSTANT_Class_info
structure specifying the class using this constant pool table.getUtf8Info
(int index) ReadsCONSTANT_utf8_info
structure at the given index.int
isConstructor
(String classname, int index) Determines whetherCONSTANT_Methodref_info
structure at the given index represents the constructor of the given class.int
Determines whetherCONSTANT_Methodref_info
,CONSTANT_Fieldref_info
, orCONSTANT_InterfaceMethodref_info
structure at the given index represents the member with the specified name and declaring class.void
print()
Prints the contents of the constant pool table.void
print
(PrintWriter out) Prints the contents of the constant pool table.void
renameClass
(String oldName, String newName) Replaces all occurrences of a class name.void
renameClass
(Map<String, String> classnames) Replaces all occurrences of class names.void
write
(DataOutputStream out) Writes the contents of the constant pool table.
-
Field Details
-
CONST_Class
public static final int CONST_ClassCONSTANT_Class
- See Also:
-
CONST_Fieldref
public static final int CONST_FieldrefCONSTANT_Fieldref
- See Also:
-
CONST_Methodref
public static final int CONST_MethodrefCONSTANT_Methodref
- See Also:
-
CONST_InterfaceMethodref
public static final int CONST_InterfaceMethodrefCONSTANT_InterfaceMethodref
- See Also:
-
CONST_String
public static final int CONST_StringCONSTANT_String
- See Also:
-
CONST_Integer
public static final int CONST_IntegerCONSTANT_Integer
- See Also:
-
CONST_Float
public static final int CONST_FloatCONSTANT_Float
- See Also:
-
CONST_Long
public static final int CONST_LongCONSTANT_Long
- See Also:
-
CONST_Double
public static final int CONST_DoubleCONSTANT_Double
- See Also:
-
CONST_NameAndType
public static final int CONST_NameAndTypeCONSTANT_NameAndType
- See Also:
-
CONST_Utf8
public static final int CONST_Utf8CONSTANT_Utf8
- See Also:
-
CONST_MethodHandle
public static final int CONST_MethodHandleCONSTANT_MethodHandle
- See Also:
-
CONST_MethodType
public static final int CONST_MethodTypeCONSTANT_MethodHandle
- See Also:
-
CONST_Dynamic
public static final int CONST_DynamicCONSTANT_Dynamic
- See Also:
-
CONST_DynamicCallSite
public static final int CONST_DynamicCallSiteCONSTANT_DynamicCallSite
, also known asCONSTANT_InvokeDynamic
- See Also:
-
CONST_InvokeDynamic
public static final int CONST_InvokeDynamic- See Also:
-
CONST_Module
public static final int CONST_ModuleCONSTANT_Module
- See Also:
-
CONST_Package
public static final int CONST_PackageCONSTANT_Package
- See Also:
-
THIS
Represents the class using this constant pool table. -
REF_getField
public static final int REF_getFieldreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_getStatic
public static final int REF_getStaticreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_putField
public static final int REF_putFieldreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_putStatic
public static final int REF_putStaticreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_invokeVirtual
public static final int REF_invokeVirtualreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_invokeStatic
public static final int REF_invokeStaticreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_invokeSpecial
public static final int REF_invokeSpecialreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_newInvokeSpecial
public static final int REF_newInvokeSpecialreference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
REF_invokeInterface
public static final int REF_invokeInterfacereference_kind
ofCONSTANT_MethodHandle_info
.- See Also:
-
-
Constructor Details
-
ConstPool
Constructs a constant pool table.- Parameters:
thisclass
- the name of the class using this constant pool table
-
ConstPool
Constructs a constant pool table from the given byte stream.- Parameters:
in
- byte stream.- Throws:
IOException
-
-
Method Details
-
getSize
public int getSize()Returns the number of entries in this table. -
getClassName
Returns the name of the class using this constant pool table. -
getThisClassInfo
public int getThisClassInfo()Returns the index ofCONSTANT_Class_info
structure specifying the class using this constant pool table. -
getTag
public int getTag(int index) Returns thetag
field of the constant pool table entry at the given index.- Returns:
- either
CONST_Class
,CONST_Fieldref
,CONST_Methodref
, or ...
-
getClassInfo
ReadsCONSTANT_Class_info
structure at the given index.- Returns:
- a fully-qualified class or interface name specified
by
name_index
. If the type is an array type, this method returns an encoded name like[Ljava.lang.Object;
(note that the separators are not slashes but dots). - See Also:
-
getClassInfoByDescriptor
ReadsCONSTANT_Class_info
structure at the given index.- Returns:
- the descriptor of the type specified
by
name_index
. - Since:
- 3.15
- See Also:
-
getNameAndTypeName
public int getNameAndTypeName(int index) Reads thename_index
field of theCONSTANT_NameAndType_info
structure at the given index. -
getNameAndTypeDescriptor
public int getNameAndTypeDescriptor(int index) Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure at the given index. -
getMemberClass
public int getMemberClass(int index) Reads theclass_index
field of theCONSTANT_Fieldref_info
,CONSTANT_Methodref_info
, orCONSTANT_Interfaceref_info
, structure at the given index.- Since:
- 3.6
-
getMemberNameAndType
public int getMemberNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_Fieldref_info
,CONSTANT_Methodref_info
, orCONSTANT_Interfaceref_info
, structure at the given index.- Since:
- 3.6
-
getFieldrefClass
public int getFieldrefClass(int index) Reads theclass_index
field of theCONSTANT_Fieldref_info
structure at the given index. -
getFieldrefClassName
Reads theclass_index
field of theCONSTANT_Fieldref_info
structure at the given index.- Returns:
- the name of the class at that
class_index
.
-
getFieldrefNameAndType
public int getFieldrefNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_Fieldref_info
structure at the given index. -
getFieldrefName
Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_Fieldref_info
.- Returns:
- the name of the field.
-
getFieldrefType
Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_Fieldref_info
.- Returns:
- the type descriptor of the field.
-
getMethodrefClass
public int getMethodrefClass(int index) Reads theclass_index
field of theCONSTANT_Methodref_info
structure at the given index. -
getMethodrefClassName
Reads theclass_index
field of theCONSTANT_Methodref_info
structure at the given index.- Returns:
- the name of the class at that
class_index
.
-
getMethodrefNameAndType
public int getMethodrefNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_Methodref_info
structure at the given index. -
getMethodrefName
Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_Methodref_info
.- Returns:
- the name of the method.
-
getMethodrefType
Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_Methodref_info
.- Returns:
- the descriptor of the method.
-
getInterfaceMethodrefClass
public int getInterfaceMethodrefClass(int index) Reads theclass_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index. -
getInterfaceMethodrefClassName
Reads theclass_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index.- Returns:
- the name of the class at that
class_index
.
-
getInterfaceMethodrefNameAndType
public int getInterfaceMethodrefNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_InterfaceMethodref_info
structure at the given index. -
getInterfaceMethodrefName
Reads thename_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_InterfaceMethodref_info
.- Returns:
- the name of the method.
-
getInterfaceMethodrefType
Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_InterfaceMethodref_info
.- Returns:
- the descriptor of the method.
-
getLdcValue
ReadsCONSTANT_Integer_info
,_Float_info
,_Long_info
,_Double_info
, or_String_info
structure. These are used with the LDC instruction.- Returns:
- a
String
value or a wrapped primitive-type value.
-
getIntegerInfo
public int getIntegerInfo(int index) ReadsCONSTANT_Integer_info
structure at the given index.- Returns:
- the value specified by this entry.
-
getFloatInfo
public float getFloatInfo(int index) ReadsCONSTANT_Float_info
structure at the given index.- Returns:
- the value specified by this entry.
-
getLongInfo
public long getLongInfo(int index) ReadsCONSTANT_Long_info
structure at the given index.- Returns:
- the value specified by this entry.
-
getDoubleInfo
public double getDoubleInfo(int index) ReadsCONSTANT_Double_info
structure at the given index.- Returns:
- the value specified by this entry.
-
getStringInfo
ReadsCONSTANT_String_info
structure at the given index.- Returns:
- the string specified by
string_index
.
-
getUtf8Info
ReadsCONSTANT_utf8_info
structure at the given index.- Returns:
- the string specified by this entry.
-
getMethodHandleKind
public int getMethodHandleKind(int index) Reads thereference_kind
field of theCONSTANT_MethodHandle_info
structure at the given index. -
getMethodHandleIndex
public int getMethodHandleIndex(int index) Reads thereference_index
field of theCONSTANT_MethodHandle_info
structure at the given index.- Since:
- 3.17
-
getMethodTypeInfo
public int getMethodTypeInfo(int index) Reads thedescriptor_index
field of theCONSTANT_MethodType_info
structure at the given index.- Since:
- 3.17
-
getInvokeDynamicBootstrap
public int getInvokeDynamicBootstrap(int index) Reads thebootstrap_method_attr_index
field of theCONSTANT_InvokeDynamic_info
structure at the given index.- Since:
- 3.17
-
getInvokeDynamicNameAndType
public int getInvokeDynamicNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_InvokeDynamic_info
structure at the given index.- Since:
- 3.17
-
getInvokeDynamicType
Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_InvokeDynamic_info
.- Returns:
- the descriptor of the bootstrap method.
- Since:
- 3.17
-
getDynamicBootstrap
public int getDynamicBootstrap(int index) Reads thebootstrap_method_attr_index
field of theCONSTANT_Dynamic_info
structure at the given index.- Since:
- 3.26
-
getDynamicNameAndType
public int getDynamicNameAndType(int index) Reads thename_and_type_index
field of theCONSTANT_Dynamic_info
structure at the given index.- Since:
- 3.26
-
getDynamicType
Reads thedescriptor_index
field of theCONSTANT_NameAndType_info
structure indirectly specified by the given index.- Parameters:
index
- an index to aCONSTANT_Dynamic_info
.- Returns:
- the descriptor of the bootstrap method.
- Since:
- 3.26
-
getModuleInfo
Reads thename_index
field of theCONSTANT_Module_info
structure at the given index.- Returns:
- the module name at
name_index
. - Since:
- 3.22
-
getPackageInfo
Reads thename_index
field of theCONSTANT_Package_info
structure at the given index.- Returns:
- the package name at
name_index
. It is a slash- separated name such as com/oracle/net. - Since:
- 3.22
-
isConstructor
Determines whetherCONSTANT_Methodref_info
structure at the given index represents the constructor of the given class.- Returns:
- the
descriptor_index
specifying the type descriptor of the that constructor. If it is not that constructor,isConstructor()
returns 0.
-
isMember
Determines whetherCONSTANT_Methodref_info
,CONSTANT_Fieldref_info
, orCONSTANT_InterfaceMethodref_info
structure at the given index represents the member with the specified name and declaring class.- Parameters:
classname
- the class declaring the membermembername
- the member nameindex
- the index into the constant pool table- Returns:
- the
descriptor_index
specifying the type descriptor of that member. If it is not that member,isMember()
returns 0.
-
eqMember
Determines whetherCONSTANT_Methodref_info
,CONSTANT_Fieldref_info
, orCONSTANT_InterfaceMethodref_info
structure at the given index has the name and the descriptor given as the arguments.- Parameters:
membername
- the member namedesc
- the descriptor of the member.index
- the index into the constant pool table- Returns:
- the name of the target class specified by
the
..._info
structure atindex
. Otherwise, null if that structure does not match the given member name and descriptor.
-
copy
Copies the n-th item in this ConstPool object into the destination ConstPool object. The class names that the item refers to are renamed according to the given map.- Parameters:
n
- the n-th itemdest
- destination constant pool tableclassnames
- the map or null.- Returns:
- the index of the copied item into the destination ClassPool.
-
addClassInfo
Adds a newCONSTANT_Class_info
structure.This also adds a
CONSTANT_Utf8_info
structure for storing the class name.- Returns:
- the index of the added entry.
-
addClassInfo
Adds a newCONSTANT_Class_info
structure.This also adds a
CONSTANT_Utf8_info
structure for storing the class name.- Parameters:
qname
- a fully-qualified class name (or the JVM-internal representation of that name).- Returns:
- the index of the added entry.
-
addNameAndTypeInfo
Adds a newCONSTANT_NameAndType_info
structure.This also adds
CONSTANT_Utf8_info
structures.- Parameters:
name
-name_index
type
-descriptor_index
- Returns:
- the index of the added entry.
-
addNameAndTypeInfo
public int addNameAndTypeInfo(int name, int type) Adds a newCONSTANT_NameAndType_info
structure.- Parameters:
name
-name_index
type
-descriptor_index
- Returns:
- the index of the added entry.
-
addFieldrefInfo
Adds a newCONSTANT_Fieldref_info
structure.This also adds a new
CONSTANT_NameAndType_info
structure.- Parameters:
classInfo
-class_index
name
-name_index
ofCONSTANT_NameAndType_info
.type
-descriptor_index
ofCONSTANT_NameAndType_info
.- Returns:
- the index of the added entry.
-
addFieldrefInfo
public int addFieldrefInfo(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_Fieldref_info
structure.- Parameters:
classInfo
-class_index
nameAndTypeInfo
-name_and_type_index
.- Returns:
- the index of the added entry.
-
addMethodrefInfo
Adds a newCONSTANT_Methodref_info
structure.This also adds a new
CONSTANT_NameAndType_info
structure.- Parameters:
classInfo
-class_index
name
-name_index
ofCONSTANT_NameAndType_info
.type
-descriptor_index
ofCONSTANT_NameAndType_info
.- Returns:
- the index of the added entry.
-
addMethodrefInfo
public int addMethodrefInfo(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_Methodref_info
structure.- Parameters:
classInfo
-class_index
nameAndTypeInfo
-name_and_type_index
.- Returns:
- the index of the added entry.
-
addInterfaceMethodrefInfo
Adds a newCONSTANT_InterfaceMethodref_info
structure.This also adds a new
CONSTANT_NameAndType_info
structure.- Parameters:
classInfo
-class_index
name
-name_index
ofCONSTANT_NameAndType_info
.type
-descriptor_index
ofCONSTANT_NameAndType_info
.- Returns:
- the index of the added entry.
-
addInterfaceMethodrefInfo
public int addInterfaceMethodrefInfo(int classInfo, int nameAndTypeInfo) Adds a newCONSTANT_InterfaceMethodref_info
structure.- Parameters:
classInfo
-class_index
nameAndTypeInfo
-name_and_type_index
.- Returns:
- the index of the added entry.
-
addStringInfo
Adds a newCONSTANT_String_info
structure.This also adds a new
CONSTANT_Utf8_info
structure.- Returns:
- the index of the added entry.
-
addIntegerInfo
public int addIntegerInfo(int i) Adds a newCONSTANT_Integer_info
structure.- Returns:
- the index of the added entry.
-
addFloatInfo
public int addFloatInfo(float f) Adds a newCONSTANT_Float_info
structure.- Returns:
- the index of the added entry.
-
addLongInfo
public int addLongInfo(long l) Adds a newCONSTANT_Long_info
structure.- Returns:
- the index of the added entry.
-
addDoubleInfo
public int addDoubleInfo(double d) Adds a newCONSTANT_Double_info
structure.- Returns:
- the index of the added entry.
-
addUtf8Info
Adds a newCONSTANT_Utf8_info
structure.- Returns:
- the index of the added entry.
-
addMethodHandleInfo
public int addMethodHandleInfo(int kind, int index) Adds a newCONSTANT_MethodHandle_info
structure.- Parameters:
kind
-reference_kind
such as
.REF_invokeStatic
index
-reference_index
.- Returns:
- the index of the added entry.
- Since:
- 3.17
-
addMethodTypeInfo
public int addMethodTypeInfo(int desc) Adds a newCONSTANT_MethodType_info
structure.- Parameters:
desc
-descriptor_index
.- Returns:
- the index of the added entry.
- Since:
- 3.17
-
addInvokeDynamicInfo
public int addInvokeDynamicInfo(int bootstrap, int nameAndType) Adds a newCONSTANT_InvokeDynamic_info
structure.- Parameters:
bootstrap
-bootstrap_method_attr_index
.nameAndType
-name_and_type_index
.- Returns:
- the index of the added entry.
- Since:
- 3.17
-
addDynamicInfo
public int addDynamicInfo(int bootstrap, int nameAndType) Adds a newCONSTANT_Dynamic_info
structure.- Parameters:
bootstrap
-bootstrap_method_attr_index
.nameAndType
-name_and_type_index
.- Returns:
- the index of the added entry.
- Since:
- 3.26
-
addModuleInfo
public int addModuleInfo(int nameIndex) Adds a newCONSTANT_Module_info
- Parameters:
nameIndex
- the index of the Utf8 entry.- Returns:
- the index of the added entry.
- Since:
- 3.22
-
addPackageInfo
public int addPackageInfo(int nameIndex) Adds a newCONSTANT_Package_info
- Parameters:
nameIndex
- the index of the Utf8 entry.- Returns:
- the index of the added entry.
- Since:
- 3.22
-
getClassNames
Get all the class names.- Returns:
- a set of class names (
String
objects).
-
renameClass
Replaces all occurrences of a class name.- Parameters:
oldName
- the replaced name (JVM-internal representation).newName
- the substituted name (JVM-internal representation).
-
renameClass
Replaces all occurrences of class names.- Parameters:
classnames
- specifies pairs of replaced and substituted name.
-
write
Writes the contents of the constant pool table.- Throws:
IOException
-
print
public void print()Prints the contents of the constant pool table. -
print
Prints the contents of the constant pool table.
-