Class ConstantPool
- All Implemented Interfaces:
Printable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassConstant - Base class of all constant entries(package private) classCP_Double - Constant entries that contain double-precision float data.(package private) classCP_Float - Constant entries that contain Float data.(package private) classCP_Int - Constant entries that contain Integer data.(package private) classCP_Long - Constant entries that contain LongInteger data.(package private) classCP_Str - Constant entries that contain String data.(package private) classCPX - Constant entries that contain a single constant-pool index.classCPX2 - Constant entries that contain two constant-pool indices.static enumSUBTAG - A Tag descriptor of form method-handle constantsstatic enumTAG - A Tag descriptor of constants in the constant poolNested classes/interfaces inherited from class Indenter
Indenter.NotImplementedException -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassDataReference to the class dataprivate intprivate Stringprivate intprivate Environmentprivate ArrayList<ConstantPool.Constant> The actual pool of Constantsprivate booleanprivate static final Hashtable<Byte, ConstantPool.SUBTAG> private static final Hashtable<Byte, ConstantPool.TAG> private intFields inherited from class Indenter
ARGUMENT_DELIMITER, bestEffort, BootstrapArgumentsBreakPositions, BootstrapMethodBreakPositions, CIRCULAR_COMMENT_OFFSET, COMMENT_PADDING, commentOffset, detailedOutput, dropCharacterRange, dropClasses, dropSignatures, dropSourceFile, extraDetailedOutput, hasSize, INDENT_CHAR, INDENT_OFFSET, INDENT_STEP, INDENT_STRING, INITIAL_COMMENT_OFFSET, INSTR_PREFIX_LENGTH, InvokeDynamicBreakPositions, LdwBreakPositions, LINE_SPLITTER, maxSize, maxSizeCalculated, NO_BSM_ARGUMENTS, NO_BSM_ARGUMENTS_REGEX, OPERAND_PLACEHOLDER_LENGTH, printable, printConstantPool, printCPIndex, printHEX, printLabelAsIdentifiers, printLineNumber, printLineTable, printLineTableLines, printLineTableNumbers, printLocalVariables, printLocalVariableTypes, printProgramCounter, printSourceLines, PROGRAM_COUNTER_PLACEHOLDER_LENGTH, REPLACEMENT_NO_BSM_ARGUMENTS, skipComments, STACKMAP_TYPE_PLACEHOLDER_LENGTH, sysInfo, TABLE_PADDING, tableFormat, tableToken, toolOutput, UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String_getClassName(int nameIndex) Helper for getting class name.booleanCheckEntryType(int cpIndex, ConstantPool.TAG... tags) 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.intgetConst(int cpx) Public getter - Safely gets a Constant from the CP at a given index.getConstantOfClassName(int cpx) getCPX2(ConstantPool.TAG tag) getFieldNameTypeAsString(int cpx) Gets a string representation of the constant_pool entry at the specified index, pointing to a CONSTANT_NameAndType_info structure with a field descriptor.getJavaClassName(int cpx, String formatString) Safely gets a Java class name from a ConstantClass from the CP at a given index.getMethodName(int cpx) 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.getTag(int cpIndex) protected ConstantPoolInitialize printing data once the pool was read.booleaninRange(int value) booleanprotected void(package private) ConstantPoolread(DataInputStream in) decodes a ConstantPool and it's constants from a data stream.booleanreferredBy(int cpx, ConstantPool.TAG... tags) voidsetPrintTAG(boolean value) intsize()StringValue(int cpx) Safely gets the string value of any Constant at any CP index.private StringsubtagToString(int subtag) Getter that safely gets the string descriptor of a subtagprotected voidMethods inherited from class Indenter
decIndent, decIndent, enlargedIndent, enlargedIndent, formatOperandLine, getCommentOffset, getIndentSize, getIndentStep, getIndentString, getLabelPrefix, getOffset, getPrintAttributeCommentPadding, getPrintAttributeKeyPadding, getTitle, incIndent, incIndent, Indent, IndentPadLeft, IndentPadRight, initIndent, jasmPrint, nCopies, padLeft, PadLeft, padRight, PadRight, print, print, print, print, printIndent, printIndent, printIndent, printIndentLn, printIndentLn, printIndentLn, printIndentPadLeft, printIndentPadRight, println, println, println, println, printPadLeft, printPadRight, setCommentOffset, setHasSize, setOffset, setTheSame, tableFormatSupported, tablePrintMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Printable
isPrintable
-
Field Details
-
funcInvalidCPIndex
-
tagHash
-
subTagHash
-
classData
Reference to the class data -
environment
-
pool
The actual pool of Constants -
range
-
printTAG
private boolean printTAG -
CPXPlaceHolder
-
CPXPlaceHolderLength
private int CPXPlaceHolderLength -
CPXLength
private int CPXLength -
tagPadding
private int tagPadding
-
-
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
-
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 UTF8 string, 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.
-
getMethodName
-
getFieldNameTypeAsString
Gets a string representation of the constant_pool entry at the specified index, pointing to a CONSTANT_NameAndType_info structure with a field descriptor.- Parameters:
cpx- the constant_pool index pointing to CONSTANT_NameAndType_info- Returns:
- a string presentation of the CONSTANT_NameAndType_info structure
-
referredBy
-
getJavaClassName
-
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
-
getConstantOfClassName
-
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
-
getShortClassName
-
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. -
isTableOutput
public boolean isTableOutput()- Overrides:
isTableOutputin classIndenter
-
jasmPrint
-
tablePrint
protected void tablePrint()- Overrides:
tablePrintin classIndenter
-
InitializePrintData
Initialize printing data once the pool was read. Prepare offsets, paddings, etc. needed for printing -
getCommentPadding
public int getCommentPadding() -
getIssues
-
getCPX2
-
CheckEntryType
-
getTag
-