Package org.openjdk.asmtools.jdis
Class ConstantPool
- java.lang.Object
-
- org.openjdk.asmtools.jdis.ConstantPool
-
public class ConstantPool extends java.lang.ObjectConstantPool Class representing the ConstantPool
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classConstantPool.ConstantConstant Base class of all constant entriesstatic classConstantPool.SUBTAGSUBTAG A Tag descriptor of form method-handle constantsstatic classConstantPool.TAGTAG A Tag descriptor of constants in the constant pool
-
Field Summary
Fields Modifier and Type Field Description java.util.ArrayList<ConstantPool.Constant>poolThe actual pool of Constants
-
Constructor Summary
Constructors Constructor Description ConstantPool(ClassData cd)ConstantPool(ClassData cd, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringConstantStrValue(int cpx)ConstantStrValue Safely gets the string value of any Constant at any CP index.java.lang.StringdecodeClassDescriptor(int cpx)decodeClassDescriptor Pulls the class name out of a string (at the CP index).java.lang.StringgetClassName(int cpx)getClassName Safely gets a Java class name from a ConstantClass from the CP at a given index.java.lang.StringgetClassName(org.openjdk.asmtools.jdis.ConstantPool.CPX classConst)getClassName Safely gets a Java class name from a ConstantClass from a CPX constant pool object.java.lang.StringgetClassName(org.openjdk.asmtools.jdis.ConstantPool.CPX2 classConst)getClassName Safely gets a Java class name from a ConstantClass from a CPX2 constant pool object.ConstantPool.ConstantgetConst(int cpx)getConst Public getter - Safely gets a Constant from the CP at a given index.java.lang.StringgetModule(int cpx)getModule Public string val - Safely gets the string-rep of a ConstantModule from the CP at a given index.java.lang.StringgetName(int cpx)getTypeName Safely gets a Java name from a ConstantUTF8 from the CP at a given index.java.lang.StringgetPackage(int cpx)getPackage Public string val - Safely gets the string-rep of a ConstantPackage from the CP at a given index.java.lang.StringgetPrintedTAG(ConstantPool.TAG tag)java.lang.StringgetShortClassName(int cpx, java.lang.String pkgPrefix)getShortClassName shortens a class name (if the class is in the given package). works with a CP index to a ConstantClass.java.lang.StringgetShortClassName(java.lang.String className, java.lang.String pkgPrefix)getShortClassName shortens a class name (if the class is in the given package). works with a string-encoded classname.java.lang.StringgetString(int cpx)getString Public string val - Safely gets the string-rep of a ConstantUTF8 from the CP at a given index.voidprint(java.io.PrintWriter out)prints the entire constant pool.voidprintlnClassId(java.io.PrintWriter out, int cpx)prints a constant value, with the print format based on the print options.voidprintlnClassId(java.io.PrintWriter out, int cpx, boolean addComma)voidsetPrintTAG(boolean value)java.lang.StringStringTag(int cpx)StringTag Public string val - Safely gets the string-rep of a Constant from the CP at a given index.java.lang.StringStringValue(int cpx)StringValue Safely gets the string value of any Constant at any CP index.
-
-
-
Field Detail
-
pool
public java.util.ArrayList<ConstantPool.Constant> pool
The actual pool of Constants
-
-
Method Detail
-
setPrintTAG
public void setPrintTAG(boolean value)
-
getPrintedTAG
public java.lang.String getPrintedTAG(ConstantPool.TAG tag)
-
getConst
public ConstantPool.Constant getConst(int cpx)
getConst Public getter - Safely gets a Constant from the CP at a given index.
-
StringTag
public java.lang.String StringTag(int cpx)
StringTag Public string val - Safely gets the string-rep of a Constant from the CP at a given index.
-
getString
public java.lang.String getString(int cpx)
getString Public string val - Safely gets the string-rep of a ConstantUTF8 from the CP at a given index. Returns either null (if invalid), or the string value of the UTF8
-
getModule
public java.lang.String getModule(int cpx)
getModule Public string val - Safely gets the string-rep of a ConstantModule from the CP at a given index. Returns either null (if invalid), or the string value of the ConstantModule
-
getPackage
public java.lang.String getPackage(int cpx)
getPackage Public string val - Safely gets the string-rep of a ConstantPackage from the CP at a given index. Returns either null (if invalid), or the string value of the ConstantPackage
-
getName
public java.lang.String getName(int cpx)
getTypeName Safely gets a Java name from a ConstantUTF8 from the CP at a given index. Returns either null (if invalid), or the Java name value of the UTF8
-
getClassName
public java.lang.String getClassName(int cpx)
getClassName Safely gets a Java class name from a ConstantClass from the CP at a given index. Returns either the Java class name, or a CP index reference string.
-
getClassName
public java.lang.String getClassName(org.openjdk.asmtools.jdis.ConstantPool.CPX2 classConst)
getClassName Safely gets a Java class name from a ConstantClass from a CPX2 constant pool object. (eg. Method/Field/Interface Ref) Returns either the Java class name, or a CP index reference string.
-
getClassName
public java.lang.String getClassName(org.openjdk.asmtools.jdis.ConstantPool.CPX classConst)
getClassName Safely gets a Java class name from a ConstantClass from a CPX constant pool object. (eg. Class Ref) Returns either the Java class name, or a CP index reference string.
-
getShortClassName
public java.lang.String getShortClassName(java.lang.String className, java.lang.String pkgPrefix)getShortClassName shortens a class name (if the class is in the given package). works with a string-encoded classname.
-
getShortClassName
public java.lang.String getShortClassName(int cpx, java.lang.String pkgPrefix)getShortClassName shortens a class name (if the class is in the given package). works with a CP index to a ConstantClass.
-
decodeClassDescriptor
public java.lang.String decodeClassDescriptor(int cpx)
decodeClassDescriptor Pulls the class name out of a string (at the CP index). (drops any array descriptors, and the class descriptors ("L" and ";")
-
StringValue
public java.lang.String StringValue(int cpx)
StringValue Safely gets the string value of any Constant at any CP index.
-
ConstantStrValue
public java.lang.String ConstantStrValue(int cpx)
ConstantStrValue Safely gets the string value of any Constant at any CP index. This string is either a Constant's String value, or a CP index reference string. The Constant string has a tag descriptor in the beginning.
-
print
public void print(java.io.PrintWriter out) throws java.io.IOExceptionprints the entire constant pool.- Throws:
java.io.IOException
-
printlnClassId
public void printlnClassId(java.io.PrintWriter out, int cpx) throws java.io.IOExceptionprints a constant value, with the print format based on the print options.- Throws:
java.io.IOException
-
printlnClassId
public void printlnClassId(java.io.PrintWriter out, int cpx, boolean addComma) throws java.io.IOException- Throws:
java.io.IOException
-
-