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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
int
addArrayClass
(ArrayType type) int
int
addClass
(ObjectType type) int
addConstant
(Constant c, ConstantPool cp) int
addConstantDynamic
(int bootstrapMethodIndex, int constantNameAndTypeIndex) int
addDouble
(double d) int
addFieldref
(String class_name, String field_name, String signature) int
addFloat
(float f) int
addInteger
(int n) int
addInterfaceMethodref
(String class_name, String method_name, String signature) int
addInvokeDynamic
(int bootstrapMethodIndex, int constantNameAndTypeIndex) int
addLong
(long l) int
addMethodHandle
(byte referenceKind, int referenceIndex) int
addMethodref
(String class_name, String method_name, String signature) int
addMethodType
(int descriptorIndex) int
addNameAndType
(String name, String signature) int
int
constantToString
(int index) constantToString
(int index, byte tag) Resolve constant to a string representation.copy()
void
dump
(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) int
getModuleName
(int moduleIndex) getPackageName
(int packageIndex) int
getSize()
int
lookupClass
(String classname) int
lookupDouble
(double d) int
lookupFieldref
(String searchClassname, String searchFieldname, String searchSignature) int
lookupFloat
(float f) int
lookupInteger
(int n) int
lookupInterfaceMethodref
(String searchClassname, String searchMethodName, String searchSignature) int
lookupLong
(long l) int
lookupMethodref
(String searchClassname, String searchMethodName, String searchSignature) int
lookupNameAndType
(String searchName, String searchTypeSignature) int
int
lookupUtf8
(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) -
addConstantDynamic
public int addConstantDynamic(int bootstrapMethodIndex, int constantNameAndTypeIndex) -
addInterfaceMethodref
-
lookupInterfaceMethodref
-
lookupMethodref
-
getFinalConstantPool
-
getModuleName
-
getPackageName
-