Top Description Inners Fields Constructors Methods
org.jboss.jandex

public final Class Indexer

extends Object
Class Inheritance
Static Imports
org.jboss.jandex.ClassInfo.EnclosingMethodInfo

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.

Author
Jason T. Greene

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final byte[]
private static final int
private HashMap<DotName, List<AnnotationInstance>>
private Map<DotName, ClassInfo>
private int
private static final byte[]
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private byte[]
private byte[]
private int[]
private int
private ClassInfo
private ArrayList<AnnotationInstance>
private static final byte[]
private static final int
private static final byte[]
private static final int
private List<FieldInfo>
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private Map<DotName, List<ClassInfo>>
private static final byte[]
private static final int
private Map<DotName, Indexer.InnerClassInfo>
private static final byte[]
private static final int
private Map<DotName, List<AnnotationInstance>>
private static final byte[]
private static final int
private IdentityHashMap<MethodInfo, MethodParamList>
private List<MethodInfo>
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private DotName
private List<DotName>
private Map<DotName, ModuleInfo>
private NameTable
private static final byte[]
private static final int
private List<RecordComponentInfo>
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private static final byte[]
private static final int
private GenericSignatureParser
private IdentityHashMap<AnnotationTarget, Object>
private List<Object>
private Map<DotName, List<ClassInfo>>
private Map<DotName, List<ClassInfo>>
private final Indexer.TmpObjects
private IdentityHashMap<AnnotationTarget, List<Indexer.TypeAnnotationState>>
private Map<DotName, List<ClassInfo>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
addImplementor(DotName interfaceName, ClassInfo currentClass)

private void
addSubclass(DotName superName, ClassInfo currentClass)

private void
addSubinterface(DotName superName, ClassInfo currentClass)

private void
private void
private int
bitsToInt(byte[] pool, int pos)

private long
bitsToLong(byte[] pool, int pos)

private ArrayDeque<Indexer.InnerClassInfo>
buildClassesQueue(Type type)

Returns a list of InnerClassInfos representing types enclosing given type.

private Map<DotName, Type>
public Index

Returns:

the master index for all scanned class streams
complete
()

Completes, finalizes, and returns the index after zero or more calls to index().

private static String
private ParameterizedType
private static Type[]
private DotName
decodeClassEntry(int index)

private DotName
decodeDotNameEntry(int index, int constantType, 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
private String
private DotName
decodePackageEntry(int index)

private String
decodeUtf8Entry(int index)

private byte[]
private Type
deepCopyTypeIfNeeded(Type type)

When type contains no type variable references, returns type.

private TypeVariable
findTypeParameter(Type[] typeParameters, String identifier)

Finds and returns a type variable with given identifier among given typeParameters.

private static Type[]
private String
private boolean
private boolean
public void
index(InputStream
the class bytecode to index, must not be null
stream
)

Analyze and index the class file data present in given input stream.

public ClassInfo
public void
indexClass(Class<?>
a previously-loaded class
clazz
)

Analyze and index the class file data of given clazz.

public ClassInfo
public ClassSummary

Returns:

a summary of the just-indexed class
indexWithSummary
(InputStream
the class bytecode to index, must not be null
stream
)

Analyze and index the class file data present in given input stream.

private void
private void
private String
intern(String string)

private byte[]
intern(byte[] bytes)

private Type
intern(Type type)

private Type[]
intern(Type[] type)

private boolean
isBridge(MethodInfo methodInfo)

private static boolean
private boolean
private boolean
private static boolean
match(byte[] target, int offset, byte[] expected)

private static int
minLength(int oldLength, int minGrowth)

private static int
newLength(int oldLength, int minGrowth, int prefGrowth)

private DotName
outermostAnnotableTypeName(Type type)

Returns the name of the outermost type that encloses given type and on which type annotations are admissible.

private void
private void
private Type[]
private void
private void
private Type
parseType(String descriptor)

private Type
private void
patchTypeVariableReferences(Type type, Deque<TypeVariable> typeVarStack, AnnotationTarget parametricEncloser)

Patches all type variable references contained in given type.

private int
private AnnotationInstance
processAnnotation(DataInputStream data, AnnotationTarget target, boolean visible)

private void
private AnnotationValue
private void
processAnnotations(DataInputStream data, AnnotationTarget target, boolean visible)

private void
private void
private void
private boolean
private void
private void
private void
private void
private void
private void
private void
private void
private List<ModuleInfo.ExportedPackageInfo>
private void
private List<ModuleInfo.OpenedPackageInfo>
private void
private List<ModuleInfo.ProvidedServiceInfo>
private List<ModuleInfo.RequiredModuleInfo>
private List<DotName>
private void
private void
private ArrayList<Indexer.PathElement>
processTargetPath(DataInputStream data, Indexer.BooleanHolder genericsRequired, Indexer.BooleanHolder bridgeIncompatible)

private Indexer.TypeAnnotationState
private void
private Type
private void
private void
private void
private Type
propagateTypeVariables(Type type, AnnotationTarget parametricEncloser)

private Type
rebuildNestedType(Type last, ArrayDeque<Indexer.InnerClassInfo> classes, Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)

private void
recordAnnotation(Map<DotName, List<AnnotationInstance>> classAnnotations, DotName annotation, AnnotationInstance instance)

private void
private void
private TypeVariable
resolveTypeParameter(AnnotationTarget target, String identifier)

Resolves a given type variable identifier against given parametric target (either a method or a class).

private Type
resolveTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)

private void
private void
retargetTypeAnnotations(AnnotationTarget parametricEncloser, Type oldType, Type newType)

private Type
searchNestedType(Type type, int depth, Indexer.TypeAnnotationState typeAnnotationState)

private Type
searchTypePath(Type type, Indexer.TypeAnnotationState typeAnnotationState)

private static 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
private void
private boolean
private void
updateTypeTarget(AnnotationTarget enclosingTarget, Indexer.TypeAnnotationState typeAnnotationState)

private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait