Class Indexer
- java.lang.Object
-
- org.jboss.jandex.Indexer
-
public final class Indexer extends java.lang.Object
Analyzes and indexes the annotation and key structural information of a set of classes. The indexer will purposefully skip any class that is not Java 5 or later. It will also do a basic/quick structural scan on any class it determines does not have annotations.The Indexer operates on input streams that point to class file data. Input streams do not need to be buffered, as the indexer already does this. There is also no limit to the number of class file streams the indexer can process, other than available memory.
The Indexer attempts to minimize the final memory state of the index, but to do this it must maintain additional in-process state (intern tables etc) until the index is complete.
Numerous optimizations are taken during indexing to attempt to minimize the CPU and I/O cost, however, the Java class file format was not designed for partial searching, which ultimately limits the efficiency of processing them.
Thread-Safety This class is not thread-safe can not be shared between threads. The index it produces however is thread-safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Indexer.BooleanHolder
private static class
Indexer.InnerClassInfo
private static class
Indexer.IntegerHolder
private static class
Indexer.NameAndType
private static class
Indexer.PathElement
private static class
Indexer.PathElementStack
private static class
Indexer.TypeAnnotationState
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
ANNOTATION_DEFAULT
private static int
ANNOTATION_DEFAULT_LEN
private java.util.HashMap<DotName,java.util.List<AnnotationInstance>>
classAnnotations
private java.util.Map<DotName,ClassInfo>
classes
private int
classSignatureIndex
private static byte[]
CODE
private static int
CODE_LEN
private static int
CONSTANT_CLASS
private static int
CONSTANT_DOUBLE
private static int
CONSTANT_DYNAMIC
private static int
CONSTANT_FIELDREF
private static int
CONSTANT_FLOAT
private static int
CONSTANT_INTEGER
private static int
CONSTANT_INTERFACEMETHODREF
private static int
CONSTANT_INVOKEDYNAMIC
private static int
CONSTANT_LONG
private static int
CONSTANT_METHODHANDLE
private static int
CONSTANT_METHODREF
private static int
CONSTANT_METHODTYPE
private static int
CONSTANT_MODULE
private static int
CONSTANT_NAMEANDTYPE
private static int
CONSTANT_PACKAGE
private static int
CONSTANT_STRING
private static int
CONSTANT_UTF8
private byte[]
constantPool
private byte[]
constantPoolAnnoAttrributes
private int[]
constantPoolOffsets
private ClassInfo
currentClass
private byte[][]
debugParameterNames
private java.util.ArrayList<AnnotationInstance>
elementAnnotations
private static byte[]
ENCLOSING_METHOD
private static int
ENCLOSING_METHOD_LEN
private static byte[]
EXCEPTIONS
private static int
EXCEPTIONS_LEN
private java.util.List<FieldInfo>
fields
private static int
HAS_ANNOTATION_DEFAULT
private static int
HAS_CODE
private static int
HAS_ENCLOSING_METHOD
private static int
HAS_EXCEPTIONS
private static int
HAS_INNER_CLASSES
private static int
HAS_LOCAL_VARIABLE_TABLE
private static int
HAS_METHOD_PARAMETERS
private static int
HAS_MODULE
private static int
HAS_MODULE_MAIN_CLASS
private static int
HAS_MODULE_PACKAGES
private static int
HAS_RECORD
private static int
HAS_RUNTIME_ANNOTATION
private static int
HAS_RUNTIME_PARAM_ANNOTATION
private static int
HAS_RUNTIME_TYPE_ANNOTATION
private static int
HAS_SIGNATURE
private java.util.Map<DotName,java.util.List<ClassInfo>>
implementors
private static byte[]
INIT_METHOD_NAME
private static byte[]
INNER_CLASSES
private static int
INNER_CLASSES_LEN
private java.util.Map<DotName,Indexer.InnerClassInfo>
innerClasses
private static byte[]
LOCAL_VARIABLE_TABLE
private static int
LOCAL_VARIABLE_TABLE_LEN
private java.util.Map<DotName,java.util.List<AnnotationInstance>>
masterAnnotations
private static byte[]
METHOD_PARAMETERS
private static int
METHOD_PARAMETERS_LEN
private byte[][]
methodParameterNames
private java.util.List<MethodInfo>
methods
private static byte[]
MODULE
private static int
MODULE_LEN
private static byte[]
MODULE_MAIN_CLASS
private static int
MODULE_MAIN_CLASS_LEN
private static byte[]
MODULE_PACKAGES
private static int
MODULE_PACKAGES_LEN
private java.util.Map<DotName,ModuleInfo>
modules
private NameTable
names
private static byte[]
RECORD
private static int
RECORD_LEN
private java.util.List<RecordComponentInfo>
recordComponents
private static byte[]
RUNTIME_ANNOTATIONS
private static int
RUNTIME_ANNOTATIONS_LEN
private static byte[]
RUNTIME_PARAM_ANNOTATIONS
private static int
RUNTIME_PARAM_ANNOTATIONS_LEN
private static byte[]
RUNTIME_TYPE_ANNOTATIONS
private static int
RUNTIME_TYPE_ANNOTATIONS_LEN
private static byte[]
SIGNATURE
private static int
SIGNATURE_LEN
private GenericSignatureParser
signatureParser
private java.util.IdentityHashMap<AnnotationTarget,java.lang.Object>
signaturePresent
private java.util.List<java.lang.Object>
signatures
private java.util.Map<DotName,java.util.List<ClassInfo>>
subclasses
private java.util.IdentityHashMap<AnnotationTarget,java.util.List<Indexer.TypeAnnotationState>>
typeAnnotations
private java.util.Map<DotName,java.util.List<ClassInfo>>
users
-
Constructor Summary
Constructors Constructor Description Indexer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addImplementor(DotName interfaceName, ClassInfo currentClass)
private void
addSubclass(DotName superName, ClassInfo currentClass)
private void
applySignatures()
private int
bitsToInt(byte[] pool, int pos)
private long
bitsToLong(byte[] pool, int pos)
private java.util.ArrayDeque<Indexer.InnerClassInfo>
buildClassesQueue(DotName name)
private java.util.Map<DotName,Type>
buildOwnerMap(Type type)
Index
complete()
Completes, finalizes, and returns the index after zero or more calls to index.private static java.lang.String
convertClassFieldDescriptor(java.lang.String descriptor)
private ParameterizedType
convertParameterized(Type oType)
private static Type[]
copyTypeParameters(AnnotationTarget target)
private DotName
decodeClassEntry(int index)
private DotName
decodeDotNameEntry(int index, int constantType, java.lang.String typeName, char delim)
private double
decodeDoubleEntry(int index)
private float
decodeFloatEntry(int index)
private int
decodeIntegerEntry(int index)
private long
decodeLongEntry(int index)
private DotName
decodeModuleEntry(int index)
private Indexer.NameAndType
decodeNameAndTypeEntry(int index)
private java.lang.String
decodeOptionalUtf8Entry(int index)
private DotName
decodePackageEntry(int index)
private java.lang.String
decodeUtf8Entry(int index)
private byte[]
decodeUtf8EntryAsBytes(int index)
private static Type[]
getTypeParameters(AnnotationTarget target)
private boolean
hasAnonymousEncloser(Indexer.TypeAnnotationState typeAnnotationState)
ClassInfo
index(java.io.InputStream stream)
Analyze and index the class file data present in the passed input stream.ClassInfo
indexClass(java.lang.Class<?> clazz)
Analyze and index the class file data present in the passed class.private void
initClassFields()
private void
initIndexMaps()
private byte[]
intern(byte[] bytes)
private java.lang.String
intern(java.lang.String string)
private Type
intern(Type type)
private Type[]
intern(Type[] type)
private boolean
isBridge(MethodInfo methodInfo)
private static boolean
isInnerConstructor(MethodInfo method)
private boolean
isJDK11OrNewer(java.io.DataInputStream stream)
private static boolean
match(byte[] target, int offset, byte[] expected)
private void
parseClassSignature(java.lang.String signature, ClassInfo clazz)
private void
parseFieldSignature(java.lang.String signature, FieldInfo field)
private Type[]
parseMethodArgs(java.lang.String descriptor, Indexer.IntegerHolder pos)
private void
parseMethodSignature(java.lang.String signature, MethodInfo method)
private void
parseRecordComponentSignature(java.lang.String signature, RecordComponentInfo recordComponent)
private Type
parseType(java.lang.String descriptor)
private Type
parseType(java.lang.String descriptor, Indexer.IntegerHolder pos)
private int
popNestedDepth(Indexer.PathElementStack elements)
private AnnotationInstance
processAnnotation(java.io.DataInputStream data, AnnotationTarget target)
private void
processAnnotationDefault(java.io.DataInputStream data, MethodInfo target)
private AnnotationValue
processAnnotationElementValue(java.lang.String name, java.io.DataInputStream data)
private void
processAnnotations(java.io.DataInputStream data, AnnotationTarget target)
private void
processAttributes(java.io.DataInputStream data, AnnotationTarget target)
private void
processClassInfo(java.io.DataInputStream data)
private void
processCode(java.io.DataInputStream data, MethodInfo target)
private boolean
processConstantPool(java.io.DataInputStream stream)
private void
processEnclosingMethod(java.io.DataInputStream data, ClassInfo target)
private void
processExceptions(java.io.DataInputStream data, MethodInfo target)
private void
processFieldInfo(java.io.DataInputStream data)
private void
processInnerClasses(java.io.DataInputStream data, ClassInfo target)
private void
processLocalVariableTable(java.io.DataInputStream data, MethodInfo target)
private void
processMethodInfo(java.io.DataInputStream data)
private void
processMethodParameters(java.io.DataInputStream data, MethodInfo target)
private void
processModule(java.io.DataInputStream data, ClassInfo target)
private java.util.List<ModuleInfo.ExportedPackageInfo>
processModuleExports(java.io.DataInputStream data)
private void
processModuleMainClass(java.io.DataInputStream data, ClassInfo target)
private java.util.List<ModuleInfo.OpenedPackageInfo>
processModuleOpens(java.io.DataInputStream data)
private void
processModulePackages(java.io.DataInputStream data, ClassInfo target)
private java.util.List<ModuleInfo.ProvidedServiceInfo>
processModuleProvides(java.io.DataInputStream data)
private java.util.List<ModuleInfo.RequiredModuleInfo>
processModuleRequires(java.io.DataInputStream data)
private java.util.List<DotName>
processModuleUses(java.io.DataInputStream data)
private void
processRecordComponents(java.io.DataInputStream data)
private void
processSignature(java.io.DataInputStream data, AnnotationTarget target)
private java.util.ArrayList<Indexer.PathElement>
processTargetPath(java.io.DataInputStream data, Indexer.BooleanHolder genericsRequired, Indexer.BooleanHolder bridgeIncompatible)
private Indexer.TypeAnnotationState
processTypeAnnotation(java.io.DataInputStream data, AnnotationTarget target)
private void
processTypeAnnotations(java.io.DataInputStream data, AnnotationTarget target)
private Type
rebuildNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)
private void
recordAnnotation(java.util.Map<DotName,java.util.List<AnnotationInstance>> classAnnotations, DotName annotation, AnnotationInstance instance)
private void
resolveTypeAnnotation(AnnotationTarget target, Indexer.TypeAnnotationState typeAnnotationState)
private void
resolveTypeAnnotations()
private Type
resolveTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)
private void
resolveUsers()
private Type
searchNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)
private Type
searchTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)
private void
setTypeParameters(AnnotationTarget target, Type[] typeParameters)
private static byte[]
sizeToFit(byte[] buf, int needed, int offset, int remainingEntries)
private boolean
skipBridge(Indexer.TypeAnnotationState typeAnnotationState, MethodInfo method)
private static void
skipFully(java.io.InputStream s, long n)
private void
skipTargetPath(java.io.DataInputStream data)
private boolean
targetsArray(Indexer.TypeAnnotationState typeAnnotationState)
private void
updateTypeTarget(AnnotationTarget enclosingTarget, Indexer.TypeAnnotationState typeAnnotationState)
private void
updateTypeTargets()
private void
verifyMagic(java.io.DataInputStream stream)
-
-
-
Field Detail
-
CONSTANT_CLASS
private static final int CONSTANT_CLASS
- See Also:
- Constant Field Values
-
CONSTANT_FIELDREF
private static final int CONSTANT_FIELDREF
- See Also:
- Constant Field Values
-
CONSTANT_METHODREF
private static final int CONSTANT_METHODREF
- See Also:
- Constant Field Values
-
CONSTANT_INTERFACEMETHODREF
private static final int CONSTANT_INTERFACEMETHODREF
- See Also:
- Constant Field Values
-
CONSTANT_STRING
private static final int CONSTANT_STRING
- See Also:
- Constant Field Values
-
CONSTANT_INTEGER
private static final int CONSTANT_INTEGER
- See Also:
- Constant Field Values
-
CONSTANT_FLOAT
private static final int CONSTANT_FLOAT
- See Also:
- Constant Field Values
-
CONSTANT_LONG
private static final int CONSTANT_LONG
- See Also:
- Constant Field Values
-
CONSTANT_DOUBLE
private static final int CONSTANT_DOUBLE
- See Also:
- Constant Field Values
-
CONSTANT_NAMEANDTYPE
private static final int CONSTANT_NAMEANDTYPE
- See Also:
- Constant Field Values
-
CONSTANT_UTF8
private static final int CONSTANT_UTF8
- See Also:
- Constant Field Values
-
CONSTANT_INVOKEDYNAMIC
private static final int CONSTANT_INVOKEDYNAMIC
- See Also:
- Constant Field Values
-
CONSTANT_METHODHANDLE
private static final int CONSTANT_METHODHANDLE
- See Also:
- Constant Field Values
-
CONSTANT_METHODTYPE
private static final int CONSTANT_METHODTYPE
- See Also:
- Constant Field Values
-
CONSTANT_MODULE
private static final int CONSTANT_MODULE
- See Also:
- Constant Field Values
-
CONSTANT_PACKAGE
private static final int CONSTANT_PACKAGE
- See Also:
- Constant Field Values
-
CONSTANT_DYNAMIC
private static final int CONSTANT_DYNAMIC
- See Also:
- Constant Field Values
-
RUNTIME_ANNOTATIONS
private static final byte[] RUNTIME_ANNOTATIONS
-
RUNTIME_PARAM_ANNOTATIONS
private static final byte[] RUNTIME_PARAM_ANNOTATIONS
-
RUNTIME_TYPE_ANNOTATIONS
private static final byte[] RUNTIME_TYPE_ANNOTATIONS
-
ANNOTATION_DEFAULT
private static final byte[] ANNOTATION_DEFAULT
-
SIGNATURE
private static final byte[] SIGNATURE
-
EXCEPTIONS
private static final byte[] EXCEPTIONS
-
INNER_CLASSES
private static final byte[] INNER_CLASSES
-
ENCLOSING_METHOD
private static final byte[] ENCLOSING_METHOD
-
METHOD_PARAMETERS
private static final byte[] METHOD_PARAMETERS
-
LOCAL_VARIABLE_TABLE
private static final byte[] LOCAL_VARIABLE_TABLE
-
CODE
private static final byte[] CODE
-
MODULE
private static final byte[] MODULE
-
MODULE_PACKAGES
private static final byte[] MODULE_PACKAGES
-
MODULE_MAIN_CLASS
private static final byte[] MODULE_MAIN_CLASS
-
RECORD
private static final byte[] RECORD
-
RUNTIME_ANNOTATIONS_LEN
private static final int RUNTIME_ANNOTATIONS_LEN
-
RUNTIME_PARAM_ANNOTATIONS_LEN
private static final int RUNTIME_PARAM_ANNOTATIONS_LEN
-
RUNTIME_TYPE_ANNOTATIONS_LEN
private static final int RUNTIME_TYPE_ANNOTATIONS_LEN
-
ANNOTATION_DEFAULT_LEN
private static final int ANNOTATION_DEFAULT_LEN
-
SIGNATURE_LEN
private static final int SIGNATURE_LEN
-
EXCEPTIONS_LEN
private static final int EXCEPTIONS_LEN
-
INNER_CLASSES_LEN
private static final int INNER_CLASSES_LEN
-
ENCLOSING_METHOD_LEN
private static final int ENCLOSING_METHOD_LEN
-
METHOD_PARAMETERS_LEN
private static final int METHOD_PARAMETERS_LEN
-
LOCAL_VARIABLE_TABLE_LEN
private static final int LOCAL_VARIABLE_TABLE_LEN
-
CODE_LEN
private static final int CODE_LEN
-
MODULE_LEN
private static final int MODULE_LEN
-
MODULE_PACKAGES_LEN
private static final int MODULE_PACKAGES_LEN
-
MODULE_MAIN_CLASS_LEN
private static final int MODULE_MAIN_CLASS_LEN
-
RECORD_LEN
private static final int RECORD_LEN
-
HAS_RUNTIME_ANNOTATION
private static final int HAS_RUNTIME_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_RUNTIME_PARAM_ANNOTATION
private static final int HAS_RUNTIME_PARAM_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_RUNTIME_TYPE_ANNOTATION
private static final int HAS_RUNTIME_TYPE_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_SIGNATURE
private static final int HAS_SIGNATURE
- See Also:
- Constant Field Values
-
HAS_EXCEPTIONS
private static final int HAS_EXCEPTIONS
- See Also:
- Constant Field Values
-
HAS_INNER_CLASSES
private static final int HAS_INNER_CLASSES
- See Also:
- Constant Field Values
-
HAS_ENCLOSING_METHOD
private static final int HAS_ENCLOSING_METHOD
- See Also:
- Constant Field Values
-
HAS_ANNOTATION_DEFAULT
private static final int HAS_ANNOTATION_DEFAULT
- See Also:
- Constant Field Values
-
HAS_METHOD_PARAMETERS
private static final int HAS_METHOD_PARAMETERS
- See Also:
- Constant Field Values
-
HAS_LOCAL_VARIABLE_TABLE
private static final int HAS_LOCAL_VARIABLE_TABLE
- See Also:
- Constant Field Values
-
HAS_CODE
private static final int HAS_CODE
- See Also:
- Constant Field Values
-
HAS_MODULE
private static final int HAS_MODULE
- See Also:
- Constant Field Values
-
HAS_MODULE_PACKAGES
private static final int HAS_MODULE_PACKAGES
- See Also:
- Constant Field Values
-
HAS_MODULE_MAIN_CLASS
private static final int HAS_MODULE_MAIN_CLASS
- See Also:
- Constant Field Values
-
HAS_RECORD
private static final int HAS_RECORD
- See Also:
- Constant Field Values
-
INIT_METHOD_NAME
private static final byte[] INIT_METHOD_NAME
-
constantPool
private byte[] constantPool
-
constantPoolOffsets
private int[] constantPoolOffsets
-
constantPoolAnnoAttrributes
private byte[] constantPoolAnnoAttrributes
-
currentClass
private ClassInfo currentClass
-
classAnnotations
private java.util.HashMap<DotName,java.util.List<AnnotationInstance>> classAnnotations
-
elementAnnotations
private java.util.ArrayList<AnnotationInstance> elementAnnotations
-
signaturePresent
private java.util.IdentityHashMap<AnnotationTarget,java.lang.Object> signaturePresent
-
signatures
private java.util.List<java.lang.Object> signatures
-
classSignatureIndex
private int classSignatureIndex
-
innerClasses
private java.util.Map<DotName,Indexer.InnerClassInfo> innerClasses
-
typeAnnotations
private java.util.IdentityHashMap<AnnotationTarget,java.util.List<Indexer.TypeAnnotationState>> typeAnnotations
-
methods
private java.util.List<MethodInfo> methods
-
fields
private java.util.List<FieldInfo> fields
-
recordComponents
private java.util.List<RecordComponentInfo> recordComponents
-
debugParameterNames
private byte[][] debugParameterNames
-
methodParameterNames
private byte[][] methodParameterNames
-
masterAnnotations
private java.util.Map<DotName,java.util.List<AnnotationInstance>> masterAnnotations
-
modules
private java.util.Map<DotName,ModuleInfo> modules
-
names
private NameTable names
-
signatureParser
private GenericSignatureParser signatureParser
-
-
Method Detail
-
match
private static boolean match(byte[] target, int offset, byte[] expected)
-
sizeToFit
private static byte[] sizeToFit(byte[] buf, int needed, int offset, int remainingEntries)
-
skipFully
private static void skipFully(java.io.InputStream s, long n) throws java.io.IOException
- Throws:
java.io.IOException
-
initIndexMaps
private void initIndexMaps()
-
initClassFields
private void initClassFields()
-
processMethodInfo
private void processMethodInfo(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processFieldInfo
private void processFieldInfo(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processRecordComponents
private void processRecordComponents(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processAttributes
private void processAttributes(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
processModule
private void processModule(java.io.DataInputStream data, ClassInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleRequires
private java.util.List<ModuleInfo.RequiredModuleInfo> processModuleRequires(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleExports
private java.util.List<ModuleInfo.ExportedPackageInfo> processModuleExports(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleOpens
private java.util.List<ModuleInfo.OpenedPackageInfo> processModuleOpens(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleUses
private java.util.List<DotName> processModuleUses(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleProvides
private java.util.List<ModuleInfo.ProvidedServiceInfo> processModuleProvides(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processModulePackages
private void processModulePackages(java.io.DataInputStream data, ClassInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processModuleMainClass
private void processModuleMainClass(java.io.DataInputStream data, ClassInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processCode
private void processCode(java.io.DataInputStream data, MethodInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processAnnotationDefault
private void processAnnotationDefault(java.io.DataInputStream data, MethodInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processAnnotations
private void processAnnotations(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
processInnerClasses
private void processInnerClasses(java.io.DataInputStream data, ClassInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processMethodParameters
private void processMethodParameters(java.io.DataInputStream data, MethodInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processLocalVariableTable
private void processLocalVariableTable(java.io.DataInputStream data, MethodInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processEnclosingMethod
private void processEnclosingMethod(java.io.DataInputStream data, ClassInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processTypeAnnotations
private void processTypeAnnotations(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
processTypeAnnotation
private Indexer.TypeAnnotationState processTypeAnnotation(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
resolveTypeAnnotations
private void resolveTypeAnnotations()
-
resolveUsers
private void resolveUsers() throws java.io.IOException
- Throws:
java.io.IOException
-
updateTypeTargets
private void updateTypeTargets()
-
getTypeParameters
private static Type[] getTypeParameters(AnnotationTarget target)
-
copyTypeParameters
private static Type[] copyTypeParameters(AnnotationTarget target)
-
setTypeParameters
private void setTypeParameters(AnnotationTarget target, Type[] typeParameters)
-
isInnerConstructor
private static boolean isInnerConstructor(MethodInfo method)
-
resolveTypeAnnotation
private void resolveTypeAnnotation(AnnotationTarget target, Indexer.TypeAnnotationState typeAnnotationState)
-
skipBridge
private boolean skipBridge(Indexer.TypeAnnotationState typeAnnotationState, MethodInfo method)
-
isBridge
private boolean isBridge(MethodInfo methodInfo)
-
targetsArray
private boolean targetsArray(Indexer.TypeAnnotationState typeAnnotationState)
-
resolveTypePath
private Type resolveTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)
-
popNestedDepth
private int popNestedDepth(Indexer.PathElementStack elements)
-
updateTypeTarget
private void updateTypeTarget(AnnotationTarget enclosingTarget, Indexer.TypeAnnotationState typeAnnotationState)
-
searchTypePath
private Type searchTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)
-
rebuildNestedType
private Type rebuildNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)
-
convertParameterized
private ParameterizedType convertParameterized(Type oType)
-
searchNestedType
private Type searchNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)
-
hasAnonymousEncloser
private boolean hasAnonymousEncloser(Indexer.TypeAnnotationState typeAnnotationState)
-
buildClassesQueue
private java.util.ArrayDeque<Indexer.InnerClassInfo> buildClassesQueue(DotName name)
-
processTargetPath
private java.util.ArrayList<Indexer.PathElement> processTargetPath(java.io.DataInputStream data, Indexer.BooleanHolder genericsRequired, Indexer.BooleanHolder bridgeIncompatible) throws java.io.IOException
- Throws:
java.io.IOException
-
skipTargetPath
private void skipTargetPath(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processExceptions
private void processExceptions(java.io.DataInputStream data, MethodInfo target) throws java.io.IOException
- Throws:
java.io.IOException
-
processSignature
private void processSignature(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
parseClassSignature
private void parseClassSignature(java.lang.String signature, ClassInfo clazz)
-
applySignatures
private void applySignatures()
-
parseFieldSignature
private void parseFieldSignature(java.lang.String signature, FieldInfo field)
-
parseMethodSignature
private void parseMethodSignature(java.lang.String signature, MethodInfo method)
-
parseRecordComponentSignature
private void parseRecordComponentSignature(java.lang.String signature, RecordComponentInfo recordComponent)
-
processAnnotation
private AnnotationInstance processAnnotation(java.io.DataInputStream data, AnnotationTarget target) throws java.io.IOException
- Throws:
java.io.IOException
-
recordAnnotation
private void recordAnnotation(java.util.Map<DotName,java.util.List<AnnotationInstance>> classAnnotations, DotName annotation, AnnotationInstance instance)
-
intern
private java.lang.String intern(java.lang.String string)
-
intern
private byte[] intern(byte[] bytes)
-
processAnnotationElementValue
private AnnotationValue processAnnotationElementValue(java.lang.String name, java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
processClassInfo
private void processClassInfo(java.io.DataInputStream data) throws java.io.IOException
- Throws:
java.io.IOException
-
isJDK11OrNewer
private boolean isJDK11OrNewer(java.io.DataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
verifyMagic
private void verifyMagic(java.io.DataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeClassEntry
private DotName decodeClassEntry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeModuleEntry
private DotName decodeModuleEntry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
decodePackageEntry
private DotName decodePackageEntry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeDotNameEntry
private DotName decodeDotNameEntry(int index, int constantType, java.lang.String typeName, char delim) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeOptionalUtf8Entry
private java.lang.String decodeOptionalUtf8Entry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeUtf8Entry
private java.lang.String decodeUtf8Entry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeUtf8EntryAsBytes
private byte[] decodeUtf8EntryAsBytes(int index)
-
decodeNameAndTypeEntry
private Indexer.NameAndType decodeNameAndTypeEntry(int index) throws java.io.IOException
- Throws:
java.io.IOException
-
bitsToInt
private int bitsToInt(byte[] pool, int pos)
-
bitsToLong
private long bitsToLong(byte[] pool, int pos)
-
decodeIntegerEntry
private int decodeIntegerEntry(int index)
-
decodeLongEntry
private long decodeLongEntry(int index)
-
decodeFloatEntry
private float decodeFloatEntry(int index)
-
decodeDoubleEntry
private double decodeDoubleEntry(int index)
-
convertClassFieldDescriptor
private static java.lang.String convertClassFieldDescriptor(java.lang.String descriptor)
-
parseMethodArgs
private Type[] parseMethodArgs(java.lang.String descriptor, Indexer.IntegerHolder pos)
-
parseType
private Type parseType(java.lang.String descriptor)
-
parseType
private Type parseType(java.lang.String descriptor, Indexer.IntegerHolder pos)
-
processConstantPool
private boolean processConstantPool(java.io.DataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
indexClass
public ClassInfo indexClass(java.lang.Class<?> clazz) throws java.io.IOException
Analyze and index the class file data present in the passed class. Each call adds information to the final complete index; however, to aid in processing a per-class index (ClassInfo) is returned on each call.- Parameters:
clazz
- a previously-loaded class- Returns:
- a class index containing all annotations on the passed class stream
- Throws:
java.io.IOException
- if the class file data is corrupt or the underlying stream failsjava.lang.IllegalArgumentException
- if clazz is null
-
index
public ClassInfo index(java.io.InputStream stream) throws java.io.IOException
Analyze and index the class file data present in the passed input stream. Each call adds information to the final complete index; however, to aid in processing a per-class index (ClassInfo) is returned on each call.- Parameters:
stream
- a stream pointing to class file data- Returns:
- a class index containing all annotations on the passed class stream
- Throws:
java.io.IOException
- if the class file data is corrupt or the underlying stream failsjava.lang.IllegalArgumentException
- if stream is null
-
complete
public Index complete()
Completes, finalizes, and returns the index after zero or more calls to index. Future calls to index will result in a new index.- Returns:
- the master index for all scanned class streams
-
-