类 SymbolTable
java.lang.Object
cn.taketoday.bytecode.SymbolTable
The constant pool entries, the BootstrapMethods attribute entries and the (ASM specific) type
table entries of a class.
- 作者:
- Eric Bruneton, Harry Yang
- 另请参阅:
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明private intThe number of bootstrap methods inbootstrapMethods.private ByteVectorThe content of the BootstrapMethods attribute 'bootstrap_methods' array corresponding to this SymbolTable.The internal name of the class to which this symbol table belongs.final ClassWriterThe ClassWriter to which this SymbolTable belongs.private final ByteVectorThe content of the ClassFile's constant_pool JVMS structure corresponding to this SymbolTable.intThe number of constant pool items inconstantPool, plus 1.private SymbolTable.Entry[]A hash set of all the entries in this SymbolTable (this includes the constant pool entries, the bootstrap method entries and the type table entries).private intThe total number ofSymbolTable.Entryinstances inentries.intThe major version number of the class to which this symbol table belongs.private final ClassReaderThe ClassReader from which this SymbolTable was constructed, or null if it was constructed from scratch.private intThe actual number of elements intypeTable.private SymbolTable.Entry[]An ASM specific type table used to temporarily store internal names that will not necessarily be stored in the constant pool. -
构造器概要
构造器构造器说明SymbolTable(ClassWriter classWriter) Constructs a new, empty SymbolTable for the given ClassWriter.SymbolTable(ClassWriter classWriter, ClassReader classReader) Constructs a new SymbolTable for the given ClassWriter, initialized with the constant pool and bootstrap methods of the given ClassReader. -
方法概要
修饰符和类型方法说明private voidadd(SymbolTable.Entry entry) Adds the given entry in theentrieshash set.private SymboladdBootstrapMethod(int offset, int length, int hashCode) Adds a bootstrap method to the BootstrapMethods attribute of this symbol table.(专用程序包) SymboladdBootstrapMethod(Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) Adds a bootstrap method to the BootstrapMethods attribute of this symbol table.(专用程序包) SymboladdConstant(Object value) Adds a number or string constant to the constant pool of this symbol table.(专用程序包) SymboladdConstantClass(String value) Adds a CONSTANT_Class_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantDouble(double value) Adds a CONSTANT_Double_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantDynamic(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) Adds a CONSTANT_Dynamic_info to the constant pool of this symbol table.private voidaddConstantDynamicOrInvokeDynamicReference(int tag, int index, String name, String descriptor, int bootstrapMethodIndex) Adds a new CONSTANT_Dynamic_info or CONSTANT_InvokeDynamic_info to the constant pool of this symbol table.private SymboladdConstantDynamicOrInvokeDynamicReference(int tag, String name, String descriptor, int bootstrapMethodIndex) Adds a CONSTANT_Dynamic or a CONSTANT_InvokeDynamic_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantFieldref(String owner, String name, String descriptor) Adds a CONSTANT_Fieldref_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantFloat(float value) Adds a CONSTANT_Float_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantInteger(int value) Adds a CONSTANT_Integer_info to the constant pool of this symbol table.private SymboladdConstantIntegerOrFloat(int tag, int value) Adds a CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol table.private voidaddConstantIntegerOrFloat(int index, int tag, int value) Adds a new CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantInvokeDynamic(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) Adds a CONSTANT_InvokeDynamic_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantLong(long value) Adds a CONSTANT_Long_info to the constant pool of this symbol table.private voidaddConstantLongOrDouble(int index, int tag, long value) Adds a new CONSTANT_Long_info or CONSTANT_Double_info to the constant pool of this symbol table.private SymboladdConstantLongOrDouble(int tag, long value) Adds a CONSTANT_Long_info or CONSTANT_Double_info to the constant pool of this symbol table.private voidaddConstantMemberReference(int index, int tag, String owner, String name, String descriptor) Adds a new CONSTANT_Fieldref_info, CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table.private SymbolTable.EntryaddConstantMemberReference(int tag, String owner, String name, String descriptor) Adds a CONSTANT_Fieldref_info, CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table.private voidaddConstantMethodHandle(int index, int referenceKind, String owner, String name, String descriptor) Adds a new CONSTANT_MethodHandle_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantMethodHandle(int referenceKind, String owner, String name, String descriptor, boolean isInterface) Adds a CONSTANT_MethodHandle_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantMethodref(String owner, String name, String descriptor, boolean isInterface) Adds a CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantMethodType(String methodDescriptor) Adds a CONSTANT_MethodType_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantModule(String moduleName) Adds a CONSTANT_Module_info to the constant pool of this symbol table.private voidaddConstantNameAndType(int index, String name, String descriptor) Adds a new CONSTANT_NameAndType_info to the constant pool of this symbol table.(专用程序包) intaddConstantNameAndType(String name, String descriptor) Adds a CONSTANT_NameAndType_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantPackage(String packageName) Adds a CONSTANT_Package_info to the constant pool of this symbol table.(专用程序包) SymboladdConstantString(String value) Adds a CONSTANT_String_info to the constant pool of this symbol table.private voidaddConstantUtf8(int index, String value) Adds a new CONSTANT_String_info to the constant pool of this symbol table.(专用程序包) intaddConstantUtf8(String value) Adds a CONSTANT_Utf8_info to the constant pool of this symbol table.private voidaddConstantUtf8Reference(int index, int tag, String value) Adds a new CONSTANT_Class_info, CONSTANT_String_info, CONSTANT_MethodType_info, CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table.private SymboladdConstantUtf8Reference(int tag, String value) Adds a CONSTANT_Class_info, CONSTANT_String_info, CONSTANT_MethodType_info, CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table.(专用程序包) intaddMergedType(int typeTableIndex1, int typeTableIndex2) Adds a merged type in the type table of this symbol table.(专用程序包) intAdds a type in the type table of this symbol table.private intaddTypeInternal(SymbolTable.Entry entry) Adds the given type Symbol totypeTable.(专用程序包) intaddUninitializedType(String value, int bytecodeOffset) Adds anFrame.ITEM_UNINITIALIZEDtype in the type table of this symbol table.(专用程序包) intReturns the size in bytes of this symbol table's BootstrapMethods attribute.private voidcopyBootstrapMethods(ClassReader classReader, char[] charBuffer) Read the BootstrapMethods 'bootstrap_methods' array binary content and add them as entries of the SymbolTable.private SymbolTable.Entryget(int hashCode) Returns the list of entries which can potentially have the given hash code.(专用程序包) intReturns the length in bytes of this symbol table's constant_pool array.(专用程序包) ClassReaderReturns the ClassReader from which this SymbolTable was constructed.(专用程序包) SymbolgetType(int typeIndex) Returns the type table element whose index is given.private static inthash(int tag, int value) private static inthash(int tag, long value) private static intprivate static intprivate static intprivate static intprivate static intprivate static intprivate SymbolTable.Entryput(SymbolTable.Entry entry) Puts the given entry in theentrieshash set.(专用程序包) voidputBootstrapMethods(ByteVector output) Puts this symbol table's BootstrapMethods attribute in the given ByteVector.(专用程序包) voidputConstantPool(ByteVector output) Puts this symbol table's constant_pool array in the given ByteVector, preceded by the constant_pool_count value.(专用程序包) intsetMajorVersionAndClassName(int majorVersion, String className) Sets the major version and the name of the class to which this symbol table belongs.
-
字段详细资料
-
classWriter
The ClassWriter to which this SymbolTable belongs. This is only used to get access toClassWriter.getCommonSuperClass(java.lang.String, java.lang.String)and to serialize custom attributes withAttribute.write(cn.taketoday.bytecode.ClassWriter, byte[], int, int, int). -
sourceClassReader
The ClassReader from which this SymbolTable was constructed, or null if it was constructed from scratch. -
majorVersion
public int majorVersionThe major version number of the class to which this symbol table belongs. -
className
The internal name of the class to which this symbol table belongs. -
entryCount
private int entryCountThe total number ofSymbolTable.Entryinstances inentries. This includes entries that are accessible (recursively) viaSymbolTable.Entry.next. -
entries
A hash set of all the entries in this SymbolTable (this includes the constant pool entries, the bootstrap method entries and the type table entries). EachSymbolTable.Entryinstance is stored at the array index given by its hash code modulo the array size. If several entries must be stored at the same array index, they are linked together via theirSymbolTable.Entry.nextfield. The factory methods of this class make sure that this table does not contain duplicated entries. -
constantPoolCount
public int constantPoolCountThe number of constant pool items inconstantPool, plus 1. The first constant pool item has index 1, and long and double items count for two items. -
constantPool
The content of the ClassFile's constant_pool JVMS structure corresponding to this SymbolTable. The ClassFile's constant_pool_count field is not included. -
bootstrapMethodCount
private int bootstrapMethodCountThe number of bootstrap methods inbootstrapMethods. Corresponds to the BootstrapMethods_attribute's num_bootstrap_methods field value. -
bootstrapMethods
The content of the BootstrapMethods attribute 'bootstrap_methods' array corresponding to this SymbolTable. Note that the first 6 bytes of the BootstrapMethods_attribute, and its num_bootstrap_methods field, are not included. -
typeCount
private int typeCountThe actual number of elements intypeTable. These elements are stored from index 0 to typeCount (excluded). The other array entries are empty. -
typeTable
An ASM specific type table used to temporarily store internal names that will not necessarily be stored in the constant pool. This type table is used by the control flow and data flow analysis algorithm used to compute stack map frames from scratch. This array storesSymbol.TYPE_TAGandSymbol.UNINITIALIZED_TYPE_TAG) Symbol. The type symbol at indexihas itsSymbol.indexequal toi(and vice versa).
-
-
构造器详细资料
-
SymbolTable
SymbolTable(ClassWriter classWriter) Constructs a new, empty SymbolTable for the given ClassWriter.- 参数:
classWriter- a ClassWriter.
-
SymbolTable
SymbolTable(ClassWriter classWriter, ClassReader classReader) Constructs a new SymbolTable for the given ClassWriter, initialized with the constant pool and bootstrap methods of the given ClassReader.- 参数:
classWriter- a ClassWriter.classReader- the ClassReader whose constant pool and bootstrap methods must be copied to initialize the SymbolTable.
-
-
方法详细资料
-
copyBootstrapMethods
Read the BootstrapMethods 'bootstrap_methods' array binary content and add them as entries of the SymbolTable.- 参数:
classReader- the ClassReader whose bootstrap methods must be copied to initialize the SymbolTable.charBuffer- a buffer used to read strings in the constant pool.
-
getSource
ClassReader getSource()Returns the ClassReader from which this SymbolTable was constructed.- 返回:
- the ClassReader from which this SymbolTable was constructed, or null if it was constructed from scratch.
-
setMajorVersionAndClassName
Sets the major version and the name of the class to which this symbol table belongs. Also adds the class name to the constant pool.- 参数:
majorVersion- a major ClassFile version number.className- an internal class name.- 返回:
- the constant pool index of a new or already existing Symbol with the given class name.
-
getConstantPoolLength
int getConstantPoolLength()Returns the length in bytes of this symbol table's constant_pool array.- 返回:
- the length in bytes of this symbol table's constant_pool array.
-
putConstantPool
Puts this symbol table's constant_pool array in the given ByteVector, preceded by the constant_pool_count value.- 参数:
output- where the JVMS ClassFile's constant_pool array must be put.
-
computeBootstrapMethodsSize
int computeBootstrapMethodsSize()Returns the size in bytes of this symbol table's BootstrapMethods attribute. Also adds the attribute name in the constant pool.- 返回:
- the size in bytes of this symbol table's BootstrapMethods attribute.
-
putBootstrapMethods
Puts this symbol table's BootstrapMethods attribute in the given ByteVector. This includes the 6 attribute header bytes and the num_bootstrap_methods value.- 参数:
output- where the JVMS BootstrapMethods attribute must be put.
-
get
Returns the list of entries which can potentially have the given hash code.- 参数:
hashCode- aSymbolTable.Entry.hashCodevalue.- 返回:
- the list of entries which can potentially have the given hash code. The list is stored
via the
SymbolTable.Entry.nextfield.
-
put
Puts the given entry in theentrieshash set. This method does not check whetherentriesalready contains a similar entry or not.entriesis resized if necessary to avoid hash collisions (multiple entries needing to be stored at the sameentriesarray index) as much as possible, with reasonable memory usage.- 参数:
entry- an Entry (which must not already be contained inentries).- 返回:
- the given entry
-
add
Adds the given entry in theentrieshash set. This method does not check whetherentriesalready contains a similar entry or not, and does not resizeentriesif necessary.- 参数:
entry- an Entry (which must not already be contained inentries).
-
addConstant
Adds a number or string constant to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item. -
addConstantClass
Adds a CONSTANT_Class_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- the internal name of a class.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantFieldref
Adds a CONSTANT_Fieldref_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
owner- the internal name of a class.name- a field name.descriptor- a field descriptor.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantMethodref
Adds a CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
owner- the internal name of a class.name- a method name.descriptor- a method descriptor.isInterface- whether owner is an interface or not.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantMemberReference
private SymbolTable.Entry addConstantMemberReference(int tag, String owner, String name, String descriptor) Adds a CONSTANT_Fieldref_info, CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
tag- one ofSymbol.CONSTANT_FIELDREF_TAG,Symbol.CONSTANT_METHODREF_TAGorSymbol.CONSTANT_INTERFACE_METHODREF_TAG.owner- the internal name of a class.name- a field or method name.descriptor- a field or method descriptor.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantMemberReference
private void addConstantMemberReference(int index, int tag, String owner, String name, String descriptor) Adds a new CONSTANT_Fieldref_info, CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.tag- one ofSymbol.CONSTANT_FIELDREF_TAG,Symbol.CONSTANT_METHODREF_TAGorSymbol.CONSTANT_INTERFACE_METHODREF_TAG.owner- the internal name of a class.name- a field or method name.descriptor- a field or method descriptor.
-
addConstantString
Adds a CONSTANT_String_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- a string.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantInteger
Adds a CONSTANT_Integer_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- an int.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantFloat
Adds a CONSTANT_Float_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- a float.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantIntegerOrFloat
Adds a CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
tag- one ofSymbol.CONSTANT_INTEGER_TAGorSymbol.CONSTANT_FLOAT_TAG.value- an int or float.- 返回:
- a constant pool constant with the given tag and primitive values.
-
addConstantIntegerOrFloat
private void addConstantIntegerOrFloat(int index, int tag, int value) Adds a new CONSTANT_Integer_info or CONSTANT_Float_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.tag- one ofSymbol.CONSTANT_INTEGER_TAGorSymbol.CONSTANT_FLOAT_TAG.value- an int or float.
-
addConstantLong
Adds a CONSTANT_Long_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- a long.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantDouble
Adds a CONSTANT_Double_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- a double.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantLongOrDouble
Adds a CONSTANT_Long_info or CONSTANT_Double_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
tag- one ofSymbol.CONSTANT_LONG_TAGorSymbol.CONSTANT_DOUBLE_TAG.value- a long or double.- 返回:
- a constant pool constant with the given tag and primitive values.
-
addConstantLongOrDouble
private void addConstantLongOrDouble(int index, int tag, long value) Adds a new CONSTANT_Long_info or CONSTANT_Double_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.tag- one ofSymbol.CONSTANT_LONG_TAGorSymbol.CONSTANT_DOUBLE_TAG.value- a long or double.
-
addConstantNameAndType
Adds a CONSTANT_NameAndType_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
name- a field or method name.descriptor- a field or method descriptor.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantNameAndType
Adds a new CONSTANT_NameAndType_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.name- a field or method name.descriptor- a field or method descriptor.
-
addConstantUtf8
Adds a CONSTANT_Utf8_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
value- a string.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantUtf8
Adds a new CONSTANT_String_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.value- a string.
-
addConstantMethodHandle
Symbol addConstantMethodHandle(int referenceKind, String owner, String name, String descriptor, boolean isInterface) Adds a CONSTANT_MethodHandle_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
referenceKind- one ofOpcodes.H_GETFIELD,Opcodes.H_GETSTATIC,Opcodes.H_PUTFIELD,Opcodes.H_PUTSTATIC,Opcodes.H_INVOKEVIRTUAL,Opcodes.H_INVOKESTATIC,Opcodes.H_INVOKESPECIAL,Opcodes.H_NEWINVOKESPECIALorOpcodes.H_INVOKEINTERFACE.owner- the internal name of a class of interface.name- a field or method name.descriptor- a field or method descriptor.isInterface- whether owner is an interface or not.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantMethodHandle
private void addConstantMethodHandle(int index, int referenceKind, String owner, String name, String descriptor) Adds a new CONSTANT_MethodHandle_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.referenceKind- one ofOpcodes.H_GETFIELD,Opcodes.H_GETSTATIC,Opcodes.H_PUTFIELD,Opcodes.H_PUTSTATIC,Opcodes.H_INVOKEVIRTUAL,Opcodes.H_INVOKESTATIC,Opcodes.H_INVOKESPECIAL,Opcodes.H_NEWINVOKESPECIALorOpcodes.H_INVOKEINTERFACE.owner- the internal name of a class of interface.name- a field or method name.descriptor- a field or method descriptor.
-
addConstantMethodType
Adds a CONSTANT_MethodType_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
methodDescriptor- a method descriptor.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantDynamic
Symbol addConstantDynamic(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) Adds a CONSTANT_Dynamic_info to the constant pool of this symbol table. Also adds the related bootstrap method to the BootstrapMethods of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
name- a method name.descriptor- a field descriptor.bootstrapMethodHandle- a bootstrap method handle.bootstrapMethodArguments- the bootstrap method arguments.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantInvokeDynamic
Symbol addConstantInvokeDynamic(String name, String descriptor, Handle bootstrapMethodHandle, Object... bootstrapMethodArguments) Adds a CONSTANT_InvokeDynamic_info to the constant pool of this symbol table. Also adds the related bootstrap method to the BootstrapMethods of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
name- a method name.descriptor- a method descriptor.bootstrapMethodHandle- a bootstrap method handle.bootstrapMethodArguments- the bootstrap method arguments.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantDynamicOrInvokeDynamicReference
private Symbol addConstantDynamicOrInvokeDynamicReference(int tag, String name, String descriptor, int bootstrapMethodIndex) Adds a CONSTANT_Dynamic or a CONSTANT_InvokeDynamic_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
tag- one ofSymbol.CONSTANT_DYNAMIC_TAGorSymbol.CONSTANT_INVOKE_DYNAMIC_TAG.name- a method name.descriptor- a field descriptor for CONSTANT_DYNAMIC_TAG) or a method descriptor for CONSTANT_INVOKE_DYNAMIC_TAG.bootstrapMethodIndex- the index of a bootstrap method in the BootstrapMethods attribute.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantDynamicOrInvokeDynamicReference
private void addConstantDynamicOrInvokeDynamicReference(int tag, int index, String name, String descriptor, int bootstrapMethodIndex) Adds a new CONSTANT_Dynamic_info or CONSTANT_InvokeDynamic_info to the constant pool of this symbol table.- 参数:
tag- one ofSymbol.CONSTANT_DYNAMIC_TAGorSymbol.CONSTANT_INVOKE_DYNAMIC_TAG.index- the constant pool index of the new Symbol.name- a method name.descriptor- a field descriptor for CONSTANT_DYNAMIC_TAG or a method descriptor for CONSTANT_INVOKE_DYNAMIC_TAG.bootstrapMethodIndex- the index of a bootstrap method in the BootstrapMethods attribute.
-
addConstantModule
Adds a CONSTANT_Module_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
moduleName- a fully qualified name (using dots) of a module.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantPackage
Adds a CONSTANT_Package_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
packageName- the internal name of a package.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantUtf8Reference
Adds a CONSTANT_Class_info, CONSTANT_String_info, CONSTANT_MethodType_info, CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table. Does nothing if the constant pool already contains a similar item.- 参数:
tag- one ofSymbol.CONSTANT_CLASS_TAG,Symbol.CONSTANT_STRING_TAG,Symbol.CONSTANT_METHOD_TYPE_TAG,Symbol.CONSTANT_MODULE_TAGorSymbol.CONSTANT_PACKAGE_TAG.value- an internal class name, an arbitrary string, a method descriptor, a module or a package name, depending on tag.- 返回:
- a new or already existing Symbol with the given value.
-
addConstantUtf8Reference
Adds a new CONSTANT_Class_info, CONSTANT_String_info, CONSTANT_MethodType_info, CONSTANT_Module_info or CONSTANT_Package_info to the constant pool of this symbol table.- 参数:
index- the constant pool index of the new Symbol.tag- one ofSymbol.CONSTANT_CLASS_TAG,Symbol.CONSTANT_STRING_TAG,Symbol.CONSTANT_METHOD_TYPE_TAG,Symbol.CONSTANT_MODULE_TAGorSymbol.CONSTANT_PACKAGE_TAG.value- an internal class name, an arbitrary string, a method descriptor, a module or a package name, depending on tag.
-
addBootstrapMethod
Adds a bootstrap method to the BootstrapMethods attribute of this symbol table. Does nothing if the BootstrapMethods already contains a similar bootstrap method.- 参数:
bootstrapMethodHandle- a bootstrap method handle.bootstrapMethodArguments- the bootstrap method arguments.- 返回:
- a new or already existing Symbol with the given value.
-
addBootstrapMethod
Adds a bootstrap method to the BootstrapMethods attribute of this symbol table. Does nothing if the BootstrapMethods already contains a similar bootstrap method (more precisely, reverts the content ofbootstrapMethodsto remove the last, duplicate bootstrap method).- 参数:
offset- the offset of the last bootstrap method inbootstrapMethods, in bytes.length- the length of this bootstrap method inbootstrapMethods, in bytes.hashCode- the hash code of this bootstrap method.- 返回:
- a new or already existing Symbol with the given value.
-
getType
Returns the type table element whose index is given.- 参数:
typeIndex- a type table index.- 返回:
- the type table element whose index is given.
-
addType
Adds a type in the type table of this symbol table. Does nothing if the type table already contains a similar type.- 参数:
value- an internal class name.- 返回:
- the index of a new or already existing type Symbol with the given value.
-
addUninitializedType
Adds anFrame.ITEM_UNINITIALIZEDtype in the type table of this symbol table. Does nothing if the type table already contains a similar type.- 参数:
value- an internal class name.bytecodeOffset- the bytecode offset of the NEW instruction that created thisFrame.ITEM_UNINITIALIZEDtype value.- 返回:
- the index of a new or already existing type Symbol with the given value.
-
addMergedType
int addMergedType(int typeTableIndex1, int typeTableIndex2) Adds a merged type in the type table of this symbol table. Does nothing if the type table already contains a similar type.- 参数:
typeTableIndex1- aSymbol.TYPE_TAGtype, specified by its index in the type table.typeTableIndex2- anotherSymbol.TYPE_TAGtype, specified by its index in the type table.- 返回:
- the index of a new or already existing
Symbol.TYPE_TAGtype Symbol, corresponding to the common super class of the given types.
-
addTypeInternal
Adds the given type Symbol totypeTable.- 参数:
entry- aSymbol.TYPE_TAGorSymbol.UNINITIALIZED_TYPE_TAGtype symbol. The index of this Symbol must be equal to the current value oftypeCount.- 返回:
- the index in
typeTablewhere the given type was added, which is also equal to entry's index by hypothesis.
-
hash
private static int hash(int tag, int value) -
hash
private static int hash(int tag, long value) -
hash
-
hash
-
hash
-
hash
-
hash
-
hash
-