Class ConstantPool
- All Implemented Interfaces:
Printable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Constant - Base class of all constant entries(package private) class
CP_Double - Constant entries that contain double-precision float data.(package private) class
CP_Float - Constant entries that contain Float data.(package private) class
CP_Int - Constant entries that contain Integer data.(package private) class
CP_Long - Constant entries that contain LongInteger data.(package private) class
CP_Str - Constant entries that contain String data.(package private) class
CPX- Constant entries that contain a single constant-pool index.(package private) class
CPX2 - Constant entries that contain two constant-pool indices.static enum
SUBTAG - A Tag descriptor of form method-handle constantsstatic enum
TAG - A Tag descriptor of constants in the constant pool -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassData
Reference to the class dataprivate JdisEnvironment
private ArrayList<ConstantPool.Constant>
The actual pool of Constantsprivate boolean
private static final Hashtable<Byte,
ConstantPool.SUBTAG> private static final Hashtable<Byte,
ConstantPool.TAG> Fields inherited from class org.openjdk.asmtools.jdis.Indenter
ARGUMENT_DELIMITER, COMMENT_OFFSET, COMMENT_PADDING, INDENT_OFFSET, INDENT_STEP, INDENT_STRING, INSTR_PREFIX_LENGTH, LINE_SPLITTER, OPERAND_PLACEHOLDER_LENGTH, printConstantPool, printCPIndex, printHEX, printLabelAsIdentifiers, printLineTable, printLocalVars, printProgramCounter, printSourceLines, PROGRAM_COUNTER_PLACEHOLDER_LENGTH, skipComments, STACKMAP_TYPE_PLACEHOLDER_LENGTH, toolOutput
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
_getClassName
(int nameIndex) Helper for getting class name.ConstantStrValue
(int cpx) Safely gets the string value of any Constant at any CP index.decodeClassDescriptor
(int cpx) Pulls the class name out of a string (at the CP index).getClassName
(int cpx) Safely gets a Java class name from a ConstantClass from the CP at a given index.getClassName
(int cpx, Function<Integer, String> funcGetDefaultClassName) Safely gets a Java class name from a ConstantClass from the CP at a given index.getClassName
(ConstantPool.CPX classConst) Safely gets a Java class name from a ConstantClass from a CPX constant pool object.getClassName
(ConstantPool.CPX2 classConst) Safely gets a Java class name from a ConstantClass from a CPX2 constant pool object.int
private int
getConst
(int cpx) Public getter - Safely gets a Constant from the CP at a given index.getModuleName
(int cpx) getModuleName
(int cpx, Function<Integer, String> funcGetDefaultModuleName) Safely gets the string representation of a ConstantModule from the CP at a given index.getName
(int cpx) Safely gets a Java name from a ConstantUTF8 from the CP at a given index.getPackageName
(int cpx) getPackageName
(int cpx, Function<Integer, String> funcGetDefaultPackageName) Public string val - Safely gets the string representation of a ConstantPackage from the CP at a given index.getShortClassName
(int cpx, String packageName) Shortens a class name (if the class is in the given package).getShortClassName
(String className, String packageName) Shortens a class name (if the class is in the given package).Safely gets the string representation of a ConstantUTF8 from the CP at a given index.private int
private boolean
inbounds
(int cpx) bounds-check a CP index.boolean
inRange
(int value) void
print()
prints the entire constant pool.(package private) void
read
(DataInputStream in) decodes a ConstantPool and it's constants from a data stream.void
setPrintTAG
(boolean value) int
size()
StringValue
(int cpx) Safely gets the string value of any Constant at any CP index.private String
subtagToString
(int subtag) Getter that safely gets the string descriptor of a subtagMethods inherited from class org.openjdk.asmtools.jdis.Indenter
decIndent, enlargedIndent, enlargedIndent, getIndentSize, getIndentStep, getIndentString, getOffset, incIndent, Indent, IndentPadLeft, IndentPadRight, initIndent, nCopies, padLeft, PadLeft, padRight, PadRight, print, print, printIndent, printIndent, printIndent, printIndentLn, printIndentLn, printIndentLn, printIndentPadRight, println, println, println, println, printPadLeft, printPadRight, resetIndent, setCommentOffset, setOffset, setTheSame
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openjdk.asmtools.jdis.Printable
isPrintable
-
Field Details
-
tagHash
-
subTagHash
-
classData
Reference to the class data -
environment
-
pool
The actual pool of Constants -
range
-
printTAG
private boolean printTAG
-
-
Constructor Details
-
ConstantPool
-
ConstantPool
-
-
Method Details
-
setPrintTAG
public void setPrintTAG(boolean value) -
getPrintedTAG
-
size
public int size() -
inRange
public boolean inRange(int value) -
read
decodes a ConstantPool and it's constants from a data stream.- Throws:
IOException
-
inbounds
private boolean inbounds(int cpx) bounds-check a CP index. -
getConst
Public getter - Safely gets a Constant from the CP at a given index. -
getString
Safely gets the string representation of a ConstantUTF8 from the CP at a given index.Returns either the Java Module name, or a default ConstantUTF8 built by CP index with the function funcGetDefaultString like: index-> "#" + index
-
getModuleName
Safely gets the string representation of a ConstantModule from the CP at a given index.Returns either the Java Module name, or a default class name built by CP index with the function funcGetDefaultModuleName like: index-> "#" + index
-
getModuleName
-
getPackageName
Public string val - Safely gets the string representation of a ConstantPackage from the CP at a given index.Returns either the Java Package name, or a default class name built by CP index with the function funcGetDefaultPackageName like: index-> "#" + index
-
getPackageName
-
getName
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
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
Safely gets a Java class name from a ConstantClass from the CP at a given index.Returns either the Java class name, or a default class name built by CP index with the function funcGetDefaultClassName like: index-> "#" + index
-
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
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.
-
_getClassName
Helper for getting class name. It checks ConstantPool bounds, does name conversion. -
getShortClassName
Shortens a class name (if the class is in the given package). Works with a string-encoded classname.- Parameters:
className
- fully qualified name of the classpackageName
- the package
-
getShortClassName
Shortens a class name (if the class is in the given package). Works with a CP index to a ConstantClass.- Parameters:
cpx
- the Constant Pool index to a CONSTANT_Class_infopackageName
- the package
-
decodeClassDescriptor
Pulls the class name out of a string (at the CP index). (drops any array descriptors, and the class descriptors ("L" and ";") -
subtagToString
Getter that safely gets the string descriptor of a subtag -
StringValue
Safely gets the string value of any Constant at any CP index. -
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
prints the entire constant pool.- Specified by:
print
in interfacePrintable
- Overrides:
print
in classIndenter
- Throws:
IOException
-
getTagPadding
private int getTagPadding() -
getCommentPadding
private int getCommentPadding() -
getCommentOffset
public int getCommentOffset()- Overrides:
getCommentOffset
in classIndenter
- Returns:
- the common offset of comments for printing methods
-
getIssues
-