Class ConstantPoolParser


  • public class ConstantPoolParser
    extends java.lang.Object
    A small parser to read the constant pool directly, in case it contains references ASM does not support. Adapted from http://stackoverflow.com/a/32278587/23691 Constant pool types:
    See Also:
    JVM 9 Sepc, JVM 10 Sepc
    • Field Detail

      • CONSTANT_UTF8

        public static final byte CONSTANT_UTF8
        Constant CONSTANT_UTF8=1
        See Also:
        Constant Field Values
      • CONSTANT_INTEGER

        public static final byte CONSTANT_INTEGER
        Constant CONSTANT_INTEGER=3
        See Also:
        Constant Field Values
      • CONSTANT_FLOAT

        public static final byte CONSTANT_FLOAT
        Constant CONSTANT_FLOAT=4
        See Also:
        Constant Field Values
      • CONSTANT_LONG

        public static final byte CONSTANT_LONG
        Constant CONSTANT_LONG=5
        See Also:
        Constant Field Values
      • CONSTANT_DOUBLE

        public static final byte CONSTANT_DOUBLE
        Constant CONSTANT_DOUBLE=6
        See Also:
        Constant Field Values
      • CONSTANT_CLASS

        public static final byte CONSTANT_CLASS
        Constant CONSTANT_CLASS=7
        See Also:
        Constant Field Values
      • CONSTANT_STRING

        public static final byte CONSTANT_STRING
        Constant CONSTANT_STRING=8
        See Also:
        Constant Field Values
      • CONSTANT_FIELDREF

        public static final byte CONSTANT_FIELDREF
        Constant CONSTANT_FIELDREF=9
        See Also:
        Constant Field Values
      • CONSTANT_METHODREF

        public static final byte CONSTANT_METHODREF
        Constant CONSTANT_METHODREF=10
        See Also:
        Constant Field Values
      • CONSTANT_INTERFACEMETHODREF

        public static final byte CONSTANT_INTERFACEMETHODREF
        Constant CONSTANT_INTERFACEMETHODREF=11
        See Also:
        Constant Field Values
      • CONSTANT_NAME_AND_TYPE

        public static final byte CONSTANT_NAME_AND_TYPE
        Constant CONSTANT_NAME_AND_TYPE=12
        See Also:
        Constant Field Values
      • CONSTANT_METHODHANDLE

        public static final byte CONSTANT_METHODHANDLE
        Constant CONSTANT_METHODHANDLE=15
        See Also:
        Constant Field Values
      • CONSTANT_METHOD_TYPE

        public static final byte CONSTANT_METHOD_TYPE
        Constant CONSTANT_METHOD_TYPE=16
        See Also:
        Constant Field Values
      • CONSTANT_INVOKE_DYNAMIC

        public static final byte CONSTANT_INVOKE_DYNAMIC
        Constant CONSTANT_INVOKE_DYNAMIC=18
        See Also:
        Constant Field Values
      • CONSTANT_MODULE

        public static final byte CONSTANT_MODULE
        Constant CONSTANT_MODULE=19
        See Also:
        Constant Field Values
      • CONSTANT_PACKAGE

        public static final byte CONSTANT_PACKAGE
        Constant CONSTANT_PACKAGE=20
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConstantPoolParser

        public ConstantPoolParser()
    • Method Detail

      • getConstantPoolClassReferences

        static java.util.Set<java.lang.String> getConstantPoolClassReferences​(byte[] b)
      • parseConstantPoolClassReferences

        static java.util.Set<java.lang.String> parseConstantPoolClassReferences​(java.nio.ByteBuffer buf)
      • decodeString

        private static java.lang.String decodeString​(java.nio.ByteBuffer buf)
      • isImportableClass

        private static boolean isImportableClass​(java.lang.String className)
      • consumeReference

        private static void consumeReference​(java.nio.ByteBuffer buf)
      • consumeInt

        private static void consumeInt​(java.nio.ByteBuffer buf)
      • consumeFloat

        private static void consumeFloat​(java.nio.ByteBuffer buf)
      • consumeDouble

        private static void consumeDouble​(java.nio.ByteBuffer buf)
      • consumeLong

        private static void consumeLong​(java.nio.ByteBuffer buf)
      • consumeString

        private static void consumeString​(java.nio.ByteBuffer buf)
      • consumeMethodHandle

        private static void consumeMethodHandle​(java.nio.ByteBuffer buf)
      • consumeInvokeDynamic

        private static void consumeInvokeDynamic​(java.nio.ByteBuffer buf)
      • consumeModule

        private static void consumeModule​(java.nio.ByteBuffer buf)
      • consumePackage

        private static void consumePackage​(java.nio.ByteBuffer buf)