Class ConstantPoolParser
java.lang.Object
com.ibm.wala.shrike.shrikeCT.ConstantPoolParser
- All Implemented Interfaces:
ClassConstants
A ConstantPoolParser provides read-only access to the constant pool of a class file.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface ClassConstants
ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, CONSTANT_Class, CONSTANT_Double, CONSTANT_FieldRef, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodRef, CONSTANT_InvokeDynamic, CONSTANT_Long, CONSTANT_MethodHandle, CONSTANT_MethodRef, CONSTANT_MethodType, CONSTANT_Module, CONSTANT_NameAndType, CONSTANT_Package, CONSTANT_String, CONSTANT_Utf8, MAGIC, REF_getField, REF_getStatic, REF_invokeInterface, REF_invokeSpecial, REF_invokeStatic, REF_invokeVirtual, REF_newInvokeSpecial, REF_putField, REF_putStatic -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCPClass(int i) doublegetCPDouble(int i) getCPDynBootstrap(int i) getCPDynName(int i) getCPDynType(int i) floatgetCPFloat(int i) getCPHandleClass(int i) bytegetCPHandleKind(int i) getCPHandleName(int i) getCPHandleType(int i) intgetCPInt(int i) longgetCPLong(int i) getCPMethodType(int i) getCPNATName(int i) getCPNATType(int i) getCPRefClass(int i) getCPRefName(int i) getCPRefType(int i) getCPString(int i) getCPUtf8(int i) intbytegetItemType(int i) byte[]intintstatic booleanisRef(byte b) Does b represent the tag of a constant pool reference to an (interface) method or field?
-
Constructor Details
-
ConstantPoolParser
- Parameters:
bytes- the raw class file dataoffset- the start of the constant pool dataitemCount- the number of items in the pool- Throws:
InvalidClassFileException
-
-
Method Details
-
getRawBytes
public byte[] getRawBytes()- Returns:
- the buffer holding the raw class file data
-
getRawOffset
- Returns:
- the offset of the constant pool data in the raw class file buffer
- Throws:
IllegalStateException
-
getRawSize
- Returns:
- the size of the constant pool data in the raw class file buffer
- Throws:
IllegalStateException
-
getItemCount
public int getItemCount()- Returns:
- the number of constant pool items (maximum item index plus one)
-
getItemType
- Returns:
- the type of constant pool item i, or 0 if i is an unused constant pool item
- Throws:
IllegalArgumentException
-
getCPClass
- Returns:
- the name of the Class at constant pool item i, in JVM format (e.g., java/lang/Object)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPMethodType
- Returns:
- the name of the method at constant pool item i, in JVM format (e.g., java/lang/Object)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPString
- Returns:
- the String at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
isRef
public static boolean isRef(byte b) Does b represent the tag of a constant pool reference to an (interface) method or field? -
getCPRefClass
- Returns:
- the name of the class part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPRefName
- Returns:
- the name part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPRefType
- Returns:
- the type part of the FieldRef, MethodRef, or InterfaceMethodRef at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPNATName
- Returns:
- the name part of the NameAndType at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPNATType
- Returns:
- the type part of the NameAndType at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPHandleName
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPHandleType
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPHandleClass
- Returns:
- the name part of the MethodHandle at constant pool item i, in JVM format (e.g., I, Z, or Ljava/lang/Object;)
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPHandleKind
- Returns:
- the type of the MethodHandle at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPInt
- Returns:
- the value of the Integer at constant pool item i
- Throws:
IllegalArgumentException
-
getCPFloat
- Returns:
- the value of the Float at constant pool item i
- Throws:
IllegalArgumentException
-
getCPLong
- Returns:
- the value of the Long at constant pool item i
- Throws:
IllegalArgumentException
-
getCPDouble
- Returns:
- the value of the Double at constant pool item i
- Throws:
IllegalArgumentException
-
getCPDynBootstrap
public BootstrapMethodsReader.BootstrapMethod getCPDynBootstrap(int i) throws InvalidClassFileException, IllegalArgumentException - Returns:
- the BootstrapMethodTable index of the bootstrap method for this invokedynamic
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-
getCPDynName
-
getCPDynType
-
getCPUtf8
- Returns:
- the value of the Utf8 string at constant pool item i
- Throws:
InvalidClassFileExceptionIllegalArgumentException
-