public class ReflectionResolutionAnnotatedTypeFactory extends BaseAnnotatedTypeFactory
methodFromUse(MethodInvocationTree)
is called for a reflective
method invocation and reflection can be resolved, then the annotations of the
resolved method are returned.GenericAnnotatedTypeFactory.ScanState
AnnotatedTypeFactory.InheritedFromClassAnnotator
analyses, defaults, FLOW_BY_DEFAULT, flowResult, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, treeAnnotator, typeAnnotator, useFlow
checker, elements, fromTreeCache, processingEnv, qualHierarchy, root, SHOULD_CACHE, SHOULD_READ_CACHE, shouldCache, shouldReadCache, trees, typeHierarchy, types, uid, visitorState
Constructor and Description |
---|
ReflectionResolutionAnnotatedTypeFactory(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
protected void |
annotateImplicit(com.sun.source.tree.Tree tree,
AnnotatedTypeMirror type,
boolean iUseFlow) |
javax.lang.model.element.AnnotationMirror |
getAnnotationMirror(com.sun.source.tree.Tree tree,
java.lang.Class<? extends java.lang.annotation.Annotation> target)
Return the annotation on
tree that has the class
target . |
Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> |
methodFromUse(com.sun.source.tree.MethodInvocationTree tree)
Determines the type of the invoked method based on the passed method
invocation tree.
|
void |
setRoot(com.sun.source.tree.CompilationUnitTree root) |
createFlowAnalysis
analyze, annotateImplicit, annotateImplicit, annotateImplicitWithFlow, applyInferredAnnotations, constructorFromUse, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, createTreeAnnotator, createTypeAnnotator, dotOutputFileName, getDefaultedAnnotatedType, getEmptyStore, getFinalLocalValues, getInferredValueFor, getNodeForTree, getRegularExitStore, getReturnStatementStores, getStoreAfter, getStoreBefore, getSupportedMonotonicTypeQualifiers, getUseFlow, performFlowAnalysis, postDirectSuperTypes, postInit, setUseFlow
addAliasedAnnotation, addAliasedDeclAnnotation, aliasedAnnotation, annotateInheritedFromClass, annotateInheritedFromClass, buildIndexTypes, createLRUCache, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchyFactory, createSupportedTypeQualifiers, createTypeHierarchy, declarationFromElement, fromClass, fromElement, fromElement, fromElement, fromExpression, fromMember, fromNewClass, fromTypeTree, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFromTypeTree, getAnnotationWithMetaAnnotation, getBoxedType, getCurrentClassTree, getCurrentClassType, getCurrentMethodReceiver, getDeclAnnotation, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getElementUtils, getEnclosingMethod, getEnclosingType, getImplicitReceiverType, getMethodReturnType, getMethodReturnType, getPath, getProcessingEnv, getQualifierHierarchy, getReceiverType, getSelfType, getSupportedTypeQualifiers, getTreeUtils, getTypeHierarchy, getUnboxedType, getUninferredWildcardType, getVisitorState, getWildcardBoundedBy, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isWithinConstructor, postAsMemberOf, postProcessClassTree, setPathHack, toAnnotatedType, toString, type, typeVariablesFromUse
public ReflectionResolutionAnnotatedTypeFactory(BaseTypeChecker checker)
checker
- The checker of the used type systempublic void setRoot(com.sun.source.tree.CompilationUnitTree root)
setRoot
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
protected void annotateImplicit(com.sun.source.tree.Tree tree, AnnotatedTypeMirror type, boolean iUseFlow)
annotateImplicit
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
public javax.lang.model.element.AnnotationMirror getAnnotationMirror(com.sun.source.tree.Tree tree, java.lang.Class<? extends java.lang.annotation.Annotation> target)
AnnotationProvider
tree
that has the class
target
. If no annotation for the given target class exists,
the result is null
getAnnotationMirror
in interface AnnotationProvider
getAnnotationMirror
in class AnnotatedTypeFactory
tree
- The tree of which the annotation is returnedtarget
- The class of the annotationpublic Pair<AnnotatedTypeMirror.AnnotatedExecutableType,java.util.List<AnnotatedTypeMirror>> methodFromUse(com.sun.source.tree.MethodInvocationTree tree)
AnnotatedTypeFactory
AnnotatedTypes.asMemberOf(Types, AnnotatedTypeFactory, AnnotatedTypeMirror, Element)
,
and customization based on receiver type should be in accordance to its
specification.
The return type is a pair of the type of the invoked method and
the (inferred) type arguments.
Note that neither the explicitly passed nor the inferred type arguments
are guaranteed to be subtypes of the corresponding upper bounds.
See method
BaseTypeVisitor.checkTypeArguments(Tree, List, List, List)
for the checks of type argument well-formedness.
Note that "this" and "super" constructor invocations are also handled by this
method. Method AnnotatedTypeFactory.constructorFromUse(NewClassTree)
is only used for a constructor
invocation in a "new" expression.methodFromUse
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
tree
- the method invocation tree