Class ConstantPoolParser
- java.lang.Object
-
- org.apache.maven.shared.dependency.analyzer.asm.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, JVM 20 Sepc
-
-
Field Summary
Fields Modifier and Type Field Description static byte
CONSTANT_CLASS
ConstantCONSTANT_CLASS=7
static byte
CONSTANT_DOUBLE
ConstantCONSTANT_DOUBLE=6
static byte
CONSTANT_FIELDREF
ConstantCONSTANT_FIELDREF=9
static byte
CONSTANT_FLOAT
ConstantCONSTANT_FLOAT=4
static byte
CONSTANT_INTEGER
ConstantCONSTANT_INTEGER=3
static byte
CONSTANT_INTERFACEMETHODREF
ConstantCONSTANT_INTERFACEMETHODREF=11
static byte
CONSTANT_INVOKE
ConstantCONSTANT_INVOKE=17
static byte
CONSTANT_INVOKE_DYNAMIC
ConstantCONSTANT_INVOKE_DYNAMIC=18
static byte
CONSTANT_LONG
ConstantCONSTANT_LONG=5
static byte
CONSTANT_METHOD_TYPE
ConstantCONSTANT_METHOD_TYPE=16
static byte
CONSTANT_METHODHANDLE
ConstantCONSTANT_METHODHANDLE=15
static byte
CONSTANT_METHODREF
ConstantCONSTANT_METHODREF=10
static byte
CONSTANT_MODULE
ConstantCONSTANT_MODULE=19
static byte
CONSTANT_NAME_AND_TYPE
ConstantCONSTANT_NAME_AND_TYPE=12
static byte
CONSTANT_PACKAGE
ConstantCONSTANT_PACKAGE=20
static byte
CONSTANT_STRING
ConstantCONSTANT_STRING=8
static byte
CONSTANT_UTF8
ConstantCONSTANT_UTF8=1
static int
HEAD
ConstantHEAD=0xcafebabe
private static int
OX3F
private static int
OXE0
private static int
OXF0
-
Constructor Summary
Constructors Constructor Description ConstantPoolParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
addClassToResult(java.util.Set<java.lang.String> result, java.lang.String className)
private static void
consumeDouble(java.nio.ByteBuffer buf)
private static void
consumeDynamic(java.nio.ByteBuffer buf)
private static void
consumeFloat(java.nio.ByteBuffer buf)
private static void
consumeInt(java.nio.ByteBuffer buf)
private static void
consumeInvokeDynamic(java.nio.ByteBuffer buf)
private static void
consumeLong(java.nio.ByteBuffer buf)
private static void
consumeMethodHandle(java.nio.ByteBuffer buf)
private static void
consumeMethodType(java.nio.ByteBuffer buf)
private static void
consumeModule(java.nio.ByteBuffer buf)
private static void
consumePackage(java.nio.ByteBuffer buf)
private static void
consumeReference(java.nio.ByteBuffer buf)
private static void
consumeString(java.nio.ByteBuffer buf)
private static java.lang.String
decodeString(java.nio.ByteBuffer buf)
(package private) static java.util.Set<java.lang.String>
getConstantPoolClassReferences(byte[] b)
private static boolean
isImportableClass(java.lang.String className)
(package private) static java.util.Set<java.lang.String>
parseConstantPoolClassReferences(java.nio.ByteBuffer buf)
-
-
-
Field Detail
-
HEAD
public static final int HEAD
ConstantHEAD=0xcafebabe
- See Also:
- Constant Field Values
-
CONSTANT_UTF8
public static final byte CONSTANT_UTF8
ConstantCONSTANT_UTF8=1
- See Also:
- Constant Field Values
-
CONSTANT_INTEGER
public static final byte CONSTANT_INTEGER
ConstantCONSTANT_INTEGER=3
- See Also:
- Constant Field Values
-
CONSTANT_FLOAT
public static final byte CONSTANT_FLOAT
ConstantCONSTANT_FLOAT=4
- See Also:
- Constant Field Values
-
CONSTANT_LONG
public static final byte CONSTANT_LONG
ConstantCONSTANT_LONG=5
- See Also:
- Constant Field Values
-
CONSTANT_DOUBLE
public static final byte CONSTANT_DOUBLE
ConstantCONSTANT_DOUBLE=6
- See Also:
- Constant Field Values
-
CONSTANT_CLASS
public static final byte CONSTANT_CLASS
ConstantCONSTANT_CLASS=7
- See Also:
- Constant Field Values
-
CONSTANT_STRING
public static final byte CONSTANT_STRING
ConstantCONSTANT_STRING=8
- See Also:
- Constant Field Values
-
CONSTANT_FIELDREF
public static final byte CONSTANT_FIELDREF
ConstantCONSTANT_FIELDREF=9
- See Also:
- Constant Field Values
-
CONSTANT_METHODREF
public static final byte CONSTANT_METHODREF
ConstantCONSTANT_METHODREF=10
- See Also:
- Constant Field Values
-
CONSTANT_INTERFACEMETHODREF
public static final byte CONSTANT_INTERFACEMETHODREF
ConstantCONSTANT_INTERFACEMETHODREF=11
- See Also:
- Constant Field Values
-
CONSTANT_NAME_AND_TYPE
public static final byte CONSTANT_NAME_AND_TYPE
ConstantCONSTANT_NAME_AND_TYPE=12
- See Also:
- Constant Field Values
-
CONSTANT_METHODHANDLE
public static final byte CONSTANT_METHODHANDLE
ConstantCONSTANT_METHODHANDLE=15
- See Also:
- Constant Field Values
-
CONSTANT_METHOD_TYPE
public static final byte CONSTANT_METHOD_TYPE
ConstantCONSTANT_METHOD_TYPE=16
- See Also:
- Constant Field Values
-
CONSTANT_INVOKE
public static final byte CONSTANT_INVOKE
ConstantCONSTANT_INVOKE=17
- See Also:
- Constant Field Values
-
CONSTANT_INVOKE_DYNAMIC
public static final byte CONSTANT_INVOKE_DYNAMIC
ConstantCONSTANT_INVOKE_DYNAMIC=18
- See Also:
- Constant Field Values
-
CONSTANT_MODULE
public static final byte CONSTANT_MODULE
ConstantCONSTANT_MODULE=19
- See Also:
- Constant Field Values
-
CONSTANT_PACKAGE
public static final byte CONSTANT_PACKAGE
ConstantCONSTANT_PACKAGE=20
- See Also:
- Constant Field Values
-
OXF0
private static final int OXF0
- See Also:
- Constant Field Values
-
OXE0
private static final int OXE0
- See Also:
- Constant Field Values
-
OX3F
private static final int OX3F
- See Also:
- Constant Field Values
-
-
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)
-
addClassToResult
private static void addClassToResult(java.util.Set<java.lang.String> result, java.lang.String className)
-
decodeString
private static java.lang.String decodeString(java.nio.ByteBuffer buf)
-
isImportableClass
private static boolean isImportableClass(java.lang.String className)
-
consumeMethodType
private static void consumeMethodType(java.nio.ByteBuffer buf)
-
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)
-
consumeDynamic
private static void consumeDynamic(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)
-
-