Class ConstantPool
java.lang.Object
org.aspectj.apache.bcel.classfile.ConstantPool
- All Implemented Interfaces:
Node
This class represents the constant pool, i.e., a table of constants, of a parsed classfile. It may contain null references, due
to the JVM specification that skips an entry after an 8-byte constant (double, long) entry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintaddArrayClass(ArrayType type) intintaddClass(ObjectType type) intaddConstant(Constant c, ConstantPool cp) intaddDouble(double d) intaddFieldref(String class_name, String field_name, String signature) intaddFloat(float f) intaddInteger(int n) intaddInterfaceMethodref(String class_name, String method_name, String signature) intaddInvokeDynamic(int bootstrapMethodIndex, int constantNameAndTypeIndex) intaddLong(long l) intaddMethodHandle(byte referenceKind, int referenceIndex) intaddMethodref(String class_name, String method_name, String signature) intaddMethodType(int descriptorIndex) intaddNameAndType(String name, String signature) intintconstantToString(int index) constantToString(int index, byte tag) Resolve constant to a string representation.copy()voiddump(DataOutputStream file) getConstant(int index) getConstant(int index, byte tag) getConstantModule(int index) getConstantPackage(int index) Constant[]getConstantString(int index, byte tag) Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects.getConstantString_CONSTANTClass(int index) getConstantUtf8(int index) intgetModuleName(int moduleIndex) getPackageName(int packageIndex) intgetSize()intlookupClass(String classname) intlookupDouble(double d) intlookupFieldref(String searchClassname, String searchFieldname, String searchSignature) intlookupFloat(float f) intlookupInteger(int n) intlookupInterfaceMethodref(String searchClassname, String searchMethodName, String searchSignature) intlookupLong(long l) intlookupMethodref(String searchClassname, String searchMethodName, String searchSignature) intlookupNameAndType(String searchName, String searchTypeSignature) intintlookupUtf8(String string) toString()
-
Constructor Details
-
ConstantPool
public ConstantPool() -
ConstantPool
-
-
Method Details
-
getSize
public int getSize() -
getConstant
-
getConstant
-
copy
- Returns:
- deep copy of this constant pool
-
getConstantString
Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects. I.e. these classes have an index field that points to another entry of the constant pool of type `ConstantUtf8' which contains the real data.- Parameters:
index- Index in constant pooltag- Tag of expected constant, either ConstantClass or ConstantString- Returns:
- Contents of string reference
- Throws:
ClassFormatException- See Also:
-
constantToString
Resolve constant to a string representation. -
constantToString
-
constantToString
-
accept
-
getConstantPool
-
dump
- Throws:
IOException
-
getConstantUtf8
-
getConstantModule
-
getConstantPackage
-
getConstantString_CONSTANTClass
-
getLength
public int getLength() -
toString
-
lookupInteger
public int lookupInteger(int n) -
lookupUtf8
-
lookupClass
-
addUtf8
-
addInteger
public int addInteger(int n) -
addArrayClass
-
addClass
-
addClass
-
addFieldref
-
lookupFieldref
-
addNameAndType
-
lookupNameAndType
-
addFloat
public int addFloat(float f) -
lookupFloat
public int lookupFloat(float f) -
addDouble
public int addDouble(double d) -
lookupDouble
public int lookupDouble(double d) -
addLong
public int addLong(long l) -
lookupString
-
addString
-
lookupLong
public int lookupLong(long l) -
addConstant
-
addMethodHandle
public int addMethodHandle(byte referenceKind, int referenceIndex) -
addMethodType
public int addMethodType(int descriptorIndex) -
addMethodref
-
addInvokeDynamic
public int addInvokeDynamic(int bootstrapMethodIndex, int constantNameAndTypeIndex) -
addInterfaceMethodref
-
lookupInterfaceMethodref
-
lookupMethodref
-
getFinalConstantPool
-
getModuleName
-
getPackageName
-