Class Indexer
- java.lang.Object
-
- org.jboss.jandex.Indexer
-
public final class Indexer extends java.lang.ObjectAnalyzes 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 classIndexer.BooleanHolderprivate static classIndexer.InnerClassInfoprivate static classIndexer.IntegerHolderprivate static classIndexer.NameAndTypeprivate static classIndexer.PathElementprivate static classIndexer.PathElementStackprivate static classIndexer.TmpObjectsprivate static classIndexer.TypeAnnotationState
-
Field Summary
Fields Modifier and Type Field Description private static byte[]ANNOTATION_DEFAULTprivate static intANNOTATION_DEFAULT_LENprivate java.util.HashMap<DotName,java.util.List<AnnotationInstance>>classAnnotationsprivate java.util.Map<DotName,ClassInfo>classesprivate intclassSignatureIndexprivate static byte[]CODEprivate static intCODE_LENprivate static intCONSTANT_CLASSprivate static intCONSTANT_DOUBLEprivate static intCONSTANT_DYNAMICprivate static intCONSTANT_FIELDREFprivate static intCONSTANT_FLOATprivate static intCONSTANT_INTEGERprivate static intCONSTANT_INTERFACEMETHODREFprivate static intCONSTANT_INVOKEDYNAMICprivate static intCONSTANT_LONGprivate static intCONSTANT_METHODHANDLEprivate static intCONSTANT_METHODREFprivate static intCONSTANT_METHODTYPEprivate static intCONSTANT_MODULEprivate static intCONSTANT_NAMEANDTYPEprivate static intCONSTANT_PACKAGEprivate static intCONSTANT_STRINGprivate static intCONSTANT_UTF8private byte[]constantPoolprivate byte[]constantPoolAnnoAttrributesprivate int[]constantPoolOffsetsprivate intconstantPoolSizeprivate ClassInfocurrentClassprivate java.util.ArrayList<AnnotationInstance>elementAnnotationsprivate static byte[]ENCLOSING_METHODprivate static intENCLOSING_METHOD_LENprivate static byte[]EXCEPTIONSprivate static intEXCEPTIONS_LENprivate java.util.List<FieldInfo>fieldsprivate static intHAS_ANNOTATION_DEFAULTprivate static intHAS_CODEprivate static intHAS_ENCLOSING_METHODprivate static intHAS_EXCEPTIONSprivate static intHAS_INNER_CLASSESprivate static intHAS_LOCAL_VARIABLE_TABLEprivate static intHAS_METHOD_PARAMETERSprivate static intHAS_MODULEprivate static intHAS_MODULE_MAIN_CLASSprivate static intHAS_MODULE_PACKAGESprivate static intHAS_PERMITTED_SUBCLASSESprivate static intHAS_RECORDprivate static intHAS_RUNTIME_ANNOTATIONprivate static intHAS_RUNTIME_INVISIBLE_ANNOTATIONprivate static intHAS_RUNTIME_INVISIBLE_PARAM_ANNOTATIONprivate static intHAS_RUNTIME_INVISIBLE_TYPE_ANNOTATIONprivate static intHAS_RUNTIME_PARAM_ANNOTATIONprivate static intHAS_RUNTIME_TYPE_ANNOTATIONprivate static intHAS_SIGNATUREprivate java.util.Map<DotName,java.util.List<ClassInfo>>implementorsprivate static byte[]INNER_CLASSESprivate static intINNER_CLASSES_LENprivate java.util.Map<DotName,Indexer.InnerClassInfo>innerClassesprivate static byte[]LOCAL_VARIABLE_TABLEprivate static intLOCAL_VARIABLE_TABLE_LENprivate java.util.Map<DotName,java.util.List<AnnotationInstance>>masterAnnotationsprivate static byte[]METHOD_PARAMETERSprivate static intMETHOD_PARAMETERS_LENprivate java.util.IdentityHashMap<MethodInfo,MethodParamList>methodParamsprivate java.util.List<MethodInfo>methodsprivate static byte[]MODULEprivate static intMODULE_LENprivate static byte[]MODULE_MAIN_CLASSprivate static intMODULE_MAIN_CLASS_LENprivate static byte[]MODULE_PACKAGESprivate static intMODULE_PACKAGES_LENprivate DotNamemoduleMainClassprivate java.util.List<DotName>modulePackagesprivate java.util.Map<DotName,ModuleInfo>modulesprivate NameTablenamesprivate static byte[]PERMITTED_SUBCLASSESprivate static intPERMITTED_SUBCLASSES_LENprivate static byte[]RECORDprivate static intRECORD_LENprivate java.util.List<RecordComponentInfo>recordComponentsprivate static byte[]RUNTIME_ANNOTATIONSprivate static intRUNTIME_ANNOTATIONS_LENprivate static byte[]RUNTIME_INVISIBLE_ANNOTATIONSprivate static intRUNTIME_INVISIBLE_ANNOTATIONS_LENprivate static byte[]RUNTIME_INVISIBLE_PARAM_ANNOTATIONSprivate static intRUNTIME_INVISIBLE_PARAM_ANNOTATIONS_LENprivate static byte[]RUNTIME_INVISIBLE_TYPE_ANNOTATIONSprivate static intRUNTIME_INVISIBLE_TYPE_ANNOTATIONS_LENprivate static byte[]RUNTIME_PARAM_ANNOTATIONSprivate static intRUNTIME_PARAM_ANNOTATIONS_LENprivate static byte[]RUNTIME_TYPE_ANNOTATIONSprivate static intRUNTIME_TYPE_ANNOTATIONS_LENprivate static byte[]SIGNATUREprivate static intSIGNATURE_LENprivate GenericSignatureParsersignatureParserprivate java.util.IdentityHashMap<AnnotationTarget,java.lang.Object>signaturePresentprivate java.util.List<java.lang.Object>signaturesprivate java.util.Map<DotName,java.util.List<ClassInfo>>subclassesprivate java.util.Map<DotName,java.util.List<ClassInfo>>subinterfacesprivate Indexer.TmpObjectstmpObjectsprivate java.util.IdentityHashMap<AnnotationTarget,java.util.List<Indexer.TypeAnnotationState>>typeAnnotationsprivate java.util.Map<DotName,java.util.Set<ClassInfo>>users
-
Constructor Summary
Constructors Constructor Description Indexer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddImplementor(DotName interfaceName, ClassInfo currentClass)private voidaddSubclass(DotName superName, ClassInfo currentClass)private voidaddSubinterface(DotName superName, ClassInfo currentClass)private voidadjustMethodParameters()private voidapplySignatures()private intbitsToInt(byte[] pool, int pos)private longbitsToLong(byte[] pool, int pos)private java.util.ArrayDeque<Indexer.InnerClassInfo>buildClassesQueue(Type type)Returns a list ofIndexer.InnerClassInfos representing types enclosing giventype.private java.util.Map<DotName,Type>buildOwnerMap(Type type)Indexcomplete()Completes, finalizes, and returns the index after zero or more calls toindex().private static java.lang.StringconvertClassFieldDescriptor(java.lang.String descriptor)private ParameterizedTypeconvertParameterized(Type oType)private static Type[]copyTypeParameters(AnnotationTarget target)private DotNamedecodeClassEntry(int index)private DotNamedecodeDotNameEntry(int index, int constantType, java.lang.String typeName, char delim)private doubledecodeDoubleEntry(int index)private floatdecodeFloatEntry(int index)private intdecodeIntegerEntry(int index)private longdecodeLongEntry(int index)private DotNamedecodeModuleEntry(int index)private Indexer.NameAndTypedecodeNameAndTypeEntry(int index)private java.lang.StringdecodeOptionalUtf8Entry(int index)private DotNamedecodePackageEntry(int index)private java.lang.StringdecodeUtf8Entry(int index)private byte[]decodeUtf8EntryAsBytes(int index)private TypedeepCopyTypeIfNeeded(Type type)Whentypecontains no type variable references, returnstype.private TypeVariablefindTypeParameter(Type[] typeParameters, java.lang.String identifier)Finds and returns a type variable with givenidentifieramong giventypeParameters.private static Type[]getTypeParameters(AnnotationTarget target)private java.lang.StringgetTypeVariableIdentifier(Type typeVariable)private booleanhasAnonymousEncloser(Indexer.TypeAnnotationState typeAnnotationState)private booleanhasLocalEncloser(Indexer.TypeAnnotationState typeAnnotationState)voidindex(java.io.InputStream stream)Analyze and index the class file data present in given inputstream.ClassInfoindex$$bridge(java.io.InputStream stream)voidindexClass(java.lang.Class<?> clazz)Analyze and index the class file data of givenclazz.ClassInfoindexClass$$bridge(java.lang.Class<?> clazz)ClassSummaryindexWithSummary(java.io.InputStream stream)Analyze and index the class file data present in given inputstream.private voidinitClassFields()private voidinitIndexMaps()private byte[]intern(byte[] bytes)private java.lang.Stringintern(java.lang.String string)private Typeintern(Type type)private Type[]intern(Type[] type)private booleanisBridge(MethodInfo methodInfo)private static booleanisEnumConstructor(MethodInfo method)private booleanisInnerConstructor(MethodInfo method)private booleanisJDK11OrNewer(java.io.DataInputStream stream)private static booleanmatch(byte[] target, int offset, byte[] expected)private static intminLength(int oldLength, int minGrowth)private static intnewLength(int oldLength, int minGrowth, int prefGrowth)private DotNameoutermostAnnotableTypeName(Type type)Returns the name of the outermost type that encloses giventypeand on which type annotations are admissible.private voidparseClassSignature(java.lang.String signature, ClassInfo clazz)private voidparseFieldSignature(java.lang.String signature, FieldInfo field)private Type[]parseMethodArgs(java.lang.String descriptor, Indexer.IntegerHolder pos)private voidparseMethodSignature(java.lang.String signature, MethodInfo method)private voidparseRecordComponentSignature(java.lang.String signature, RecordComponentInfo recordComponent)private TypeparseType(java.lang.String descriptor)private TypeparseType(java.lang.String descriptor, Indexer.IntegerHolder pos)private voidpatchTypeVariableReferences(Type type, java.util.Deque<TypeVariable> typeVarStack, AnnotationTarget parametricEncloser)Patches all type variable references contained in giventype.private intpopNestedDepth(Indexer.PathElementStack elements)private AnnotationInstanceprocessAnnotation(java.io.DataInputStream data, AnnotationTarget target, boolean visible)private voidprocessAnnotationDefault(java.io.DataInputStream data, MethodInfo target)private AnnotationValueprocessAnnotationElementValue(java.lang.String name, java.io.DataInputStream data)private voidprocessAnnotations(java.io.DataInputStream data, AnnotationTarget target, boolean visible)private voidprocessAttributes(java.io.DataInputStream data, AnnotationTarget target)private voidprocessClassInfo(java.io.DataInputStream data)private voidprocessCode(java.io.DataInputStream data, MethodInfo target)private booleanprocessConstantPool(java.io.DataInputStream stream)private voidprocessEnclosingMethod(java.io.DataInputStream data, ClassInfo target)private voidprocessExceptions(java.io.DataInputStream data, MethodInfo target)private voidprocessFieldInfo(java.io.DataInputStream data)private voidprocessInnerClasses(java.io.DataInputStream data, ClassInfo target)private voidprocessLocalVariableTable(java.io.DataInputStream data, MethodInfo target)private voidprocessMethodInfo(java.io.DataInputStream data)private voidprocessMethodParameters(java.io.DataInputStream data, MethodInfo target)private voidprocessModule(java.io.DataInputStream data, ClassInfo target)private java.util.List<ModuleInfo.ExportedPackageInfo>processModuleExports(java.io.DataInputStream data)private voidprocessModuleMainClass(java.io.DataInputStream data, ClassInfo target)private java.util.List<ModuleInfo.OpenedPackageInfo>processModuleOpens(java.io.DataInputStream data)private voidprocessModulePackages(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 voidprocessPermittedSubclasses(java.io.DataInputStream data, ClassInfo target)private voidprocessRecordComponents(java.io.DataInputStream data)private voidprocessSignature(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.TypeAnnotationStateprocessTypeAnnotation(java.io.DataInputStream data, AnnotationTarget target, boolean visible)private voidprocessTypeAnnotations(java.io.DataInputStream data, AnnotationTarget target, boolean visible)private TypepropagateOneTypeParameterBound(Type type, Type[] allTypeParams, AnnotationTarget target)private voidpropagateTypeParameterBounds()private voidpropagateTypeParameterBounds(AnnotationTarget target, java.util.Deque<TypeVariable> sharedTypeVarStack)private voidpropagateTypeVariables()private TypepropagateTypeVariables(Type type, AnnotationTarget parametricEncloser)private TyperebuildNestedType(Type last, java.util.ArrayDeque<Indexer.InnerClassInfo> classes, Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)private voidrecordAnnotation(java.util.Map<DotName,java.util.List<AnnotationInstance>> classAnnotations, DotName annotation, AnnotationInstance instance)private voidrecordUsedClass(DotName usedClass)private voidrecordUsedType(Type type)private voidresolveTypeAnnotation(AnnotationTarget target, Indexer.TypeAnnotationState typeAnnotationState)private voidresolveTypeAnnotations()private TypeVariableresolveTypeParameter(AnnotationTarget target, java.lang.String identifier)Resolves a given type variableidentifieragainst given parametrictarget(either a method or a class).private TyperesolveTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)private voidresolveUsers()private voidretargetTypeAnnotations(AnnotationTarget parametricEncloser, Type oldType, Type newType)private TypesearchNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)private TypesearchTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)private static voidsetTypeParameters(AnnotationTarget target, Type[] typeParameters)private static byte[]sizeToFit(byte[] buf, int needed, int offset, int remainingEntries)private booleanskipBridge(Indexer.TypeAnnotationState typeAnnotationState, MethodInfo method)private static voidskipFully(java.io.InputStream s, long n)private voidskipTargetPath(java.io.DataInputStream data)private booleantargetsArray(Indexer.TypeAnnotationState typeAnnotationState)private voidupdateTypeTarget(AnnotationTarget enclosingTarget, Indexer.TypeAnnotationState typeAnnotationState)private voidupdateTypeTargets()private voidverifyMagic(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_INVISIBLE_ANNOTATIONS
private static final byte[] RUNTIME_INVISIBLE_ANNOTATIONS
-
RUNTIME_INVISIBLE_PARAM_ANNOTATIONS
private static final byte[] RUNTIME_INVISIBLE_PARAM_ANNOTATIONS
-
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS
private static final byte[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS
-
PERMITTED_SUBCLASSES
private static final byte[] PERMITTED_SUBCLASSES
-
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
-
RUNTIME_INVISIBLE_ANNOTATIONS_LEN
private static final int RUNTIME_INVISIBLE_ANNOTATIONS_LEN
-
RUNTIME_INVISIBLE_PARAM_ANNOTATIONS_LEN
private static final int RUNTIME_INVISIBLE_PARAM_ANNOTATIONS_LEN
-
RUNTIME_INVISIBLE_TYPE_ANNOTATIONS_LEN
private static final int RUNTIME_INVISIBLE_TYPE_ANNOTATIONS_LEN
-
PERMITTED_SUBCLASSES_LEN
private static final int PERMITTED_SUBCLASSES_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
-
HAS_RUNTIME_INVISIBLE_ANNOTATION
private static final int HAS_RUNTIME_INVISIBLE_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_RUNTIME_INVISIBLE_PARAM_ANNOTATION
private static final int HAS_RUNTIME_INVISIBLE_PARAM_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_RUNTIME_INVISIBLE_TYPE_ANNOTATION
private static final int HAS_RUNTIME_INVISIBLE_TYPE_ANNOTATION
- See Also:
- Constant Field Values
-
HAS_PERMITTED_SUBCLASSES
private static final int HAS_PERMITTED_SUBCLASSES
- See Also:
- Constant Field Values
-
constantPoolSize
private int constantPoolSize
-
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
-
methodParams
private java.util.IdentityHashMap<MethodInfo,MethodParamList> methodParams
-
modulePackages
private java.util.List<DotName> modulePackages
-
moduleMainClass
private DotName moduleMainClass
-
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
-
tmpObjects
private final Indexer.TmpObjects tmpObjects
-
-
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)
-
newLength
private static int newLength(int oldLength, int minGrowth, int prefGrowth)
-
minLength
private static int minLength(int oldLength, int minGrowth)
-
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
-
processPermittedSubclasses
private void processPermittedSubclasses(java.io.DataInputStream data, ClassInfo target) 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, boolean visible) 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, boolean visible) throws java.io.IOException- Throws:
java.io.IOException
-
processTypeAnnotation
private Indexer.TypeAnnotationState processTypeAnnotation(java.io.DataInputStream data, AnnotationTarget target, boolean visible) throws java.io.IOException
- Throws:
java.io.IOException
-
adjustMethodParameters
private void adjustMethodParameters()
-
isInnerConstructor
private boolean isInnerConstructor(MethodInfo method)
-
isEnumConstructor
private static boolean isEnumConstructor(MethodInfo method)
-
resolveTypeAnnotations
private void resolveTypeAnnotations()
-
resolveUsers
private void resolveUsers() throws java.io.IOException- Throws:
java.io.IOException
-
recordUsedType
private void recordUsedType(Type type)
-
recordUsedClass
private void recordUsedClass(DotName usedClass)
-
updateTypeTargets
private void updateTypeTargets()
-
getTypeParameters
private static Type[] getTypeParameters(AnnotationTarget target)
-
copyTypeParameters
private static Type[] copyTypeParameters(AnnotationTarget target)
-
setTypeParameters
private static void setTypeParameters(AnnotationTarget target, Type[] typeParameters)
-
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 last, java.util.ArrayDeque<Indexer.InnerClassInfo> classes, 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)
-
hasLocalEncloser
private boolean hasLocalEncloser(Indexer.TypeAnnotationState typeAnnotationState)
-
outermostAnnotableTypeName
private DotName outermostAnnotableTypeName(Type type)
Returns the name of the outermost type that encloses giventypeand on which type annotations are admissible. This is either the nearest enclosingstaticnested class, or the enclosing top-level class. Iftypeis not a nested type, returs its name.This could easily be implemented by calling
buildClassesQueue(Type)and looking at the first element. The only difference is that the present implementation doesn't allocate and is probably a little faster.
-
buildClassesQueue
private java.util.ArrayDeque<Indexer.InnerClassInfo> buildClassesQueue(Type type)
Returns a list ofIndexer.InnerClassInfos representing types enclosing giventype. Only types on which type annotations are admissible are present in the result. That is, the first element of the list represents the outermost type on which type annotations are admissible, and the last element of the list is anInnerClassInforepresentingtypeitself. Returns an empty list iftypeis not a nested type.
-
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
-
applySignatures
private void applySignatures()
-
parseClassSignature
private void parseClassSignature(java.lang.String signature, ClassInfo clazz)
-
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, boolean visible) 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 void indexClass(java.lang.Class<?> clazz) throws java.io.IOExceptionAnalyze and index the class file data of givenclazz. Each call adds information to the final complete index.- Parameters:
clazz- a previously-loaded class- Throws:
java.io.IOException- if the class file data is corrupt or the underlying stream failsjava.lang.IllegalArgumentException- ifclazzisnull
-
indexClass$$bridge
public ClassInfo indexClass$$bridge(java.lang.Class<?> clazz) throws java.io.IOException
- Throws:
java.io.IOException
-
index
public void index(java.io.InputStream stream) throws java.io.IOExceptionAnalyze and index the class file data present in given inputstream. Each call adds information to the final complete index. Closing the input stream is the caller's responsibility.- Parameters:
stream- the class bytecode to index, must not benull- Throws:
java.io.IOException- if the class file data is corrupt or the stream failsjava.lang.IllegalArgumentException- ifstreamisnull
-
index$$bridge
public ClassInfo index$$bridge(java.io.InputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
indexWithSummary
public ClassSummary indexWithSummary(java.io.InputStream stream) throws java.io.IOException
Analyze and index the class file data present in given inputstream. Each call adds information to the final complete index. Closing the input stream is the caller's responsibility.For reporting progress in batch indexers, this variant of
indexreturns a summary of the just-indexed class.- Parameters:
stream- the class bytecode to index, must not benull- Returns:
- a summary of the just-indexed class
- Throws:
java.io.IOException- if the class file data is corrupt or the stream failsjava.lang.IllegalArgumentException- ifstreamisnull
-
complete
public Index complete()
Completes, finalizes, and returns the index after zero or more calls toindex(). Future calls toindex()will result in a new index.- Returns:
- the master index for all scanned class streams
-
propagateTypeParameterBounds
private void propagateTypeParameterBounds()
-
propagateTypeParameterBounds
private void propagateTypeParameterBounds(AnnotationTarget target, java.util.Deque<TypeVariable> sharedTypeVarStack)
-
propagateOneTypeParameterBound
private Type propagateOneTypeParameterBound(Type type, Type[] allTypeParams, AnnotationTarget target)
-
deepCopyTypeIfNeeded
private Type deepCopyTypeIfNeeded(Type type)
Whentypecontains no type variable references, returnstype. Whentypedoes contain type variable references, returns a deep copy with each reference replaced by a new one. In that case, the newly created references must be patched by the caller.When called from outside,
typemust be a type variable.
-
patchTypeVariableReferences
private void patchTypeVariableReferences(Type type, java.util.Deque<TypeVariable> typeVarStack, AnnotationTarget parametricEncloser)
Patches all type variable references contained in giventype. ThetypeVarStackis used to track enclosing type variables when traversing the structure of the type; when called from outside, it must be empty and must not be used anywhere else. TheparametricEncloseris thetype's nearest enclosing annotation target that may have type parameters, that is, the nearest enclosing method or class.
-
findTypeParameter
private TypeVariable findTypeParameter(Type[] typeParameters, java.lang.String identifier)
Finds and returns a type variable with givenidentifieramong giventypeParameters. Returnsnullwhen none exists.
-
resolveTypeParameter
private TypeVariable resolveTypeParameter(AnnotationTarget target, java.lang.String identifier)
Resolves a given type variableidentifieragainst given parametrictarget(either a method or a class). That is, if thetargethas a type parameter with matching identifier, returns it; otherwise, resolvesidentifieragainsttarget's nearest enclosing method or class. Returnsnullif the identifier can't be resolved.
-
getTypeVariableIdentifier
private java.lang.String getTypeVariableIdentifier(Type typeVariable)
-
propagateTypeVariables
private void propagateTypeVariables()
-
propagateTypeVariables
private Type propagateTypeVariables(Type type, AnnotationTarget parametricEncloser)
-
retargetTypeAnnotations
private void retargetTypeAnnotations(AnnotationTarget parametricEncloser, Type oldType, Type newType)
-
-