public abstract class AccumulationAnnotatedTypeFactory extends BaseAnnotatedTypeFactory
New accumulation checkers should extend this class and implement a constructor, which should
take a BaseTypeChecker
and call both the constructor defined in this class and GenericAnnotatedTypeFactory.postInit()
.
Modifier and Type | Class and Description |
---|---|
protected class |
AccumulationAnnotatedTypeFactory.AccumulationQualifierHierarchy
All accumulation analyses share a similar type hierarchy.
|
protected class |
AccumulationAnnotatedTypeFactory.AccumulationTreeAnnotator
This tree annotator implements the following rule(s):
RRA
If a method returns its receiver, and the receiver has an accumulation type, then the
default type of the method's return value is the type of the receiver.
|
GenericAnnotatedTypeFactory.ScanState
AnnotatedTypeFactory.ParameterizedExecutableType
Modifier and Type | Field and Description |
---|---|
AnnotationMirror |
bottom
The canonical bottom annotation for this accumulation checker.
|
AnnotationMirror |
top
The canonical top annotation for this accumulation checker: an instance of the accumulator
annotation with no arguments.
|
analysis, cfgVisualizer, defaults, dependentTypesHelper, emptyStore, exceptionalExitStores, flowByDefault, flowResult, flowResultAnalysisCaches, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, transfer, treeAnnotator, typeAnnotator
checker, elements, fromExpressionTreeCache, fromMemberTreeCache, fromTypeTreeCache, ignoreUninferredTypeArguments, loader, objectGetClass, processingEnv, qualHierarchy, qualifierUpperBounds, reflectionResolver, root, shouldCache, stubTypes, trees, typeArgumentInference, typeFormatter, typeHierarchy, types, typeVarSubstitutor, uid, visitorState
Modifier | Constructor and Description |
---|---|
protected |
AccumulationAnnotatedTypeFactory(BaseTypeChecker checker,
Class<? extends Annotation> accumulator,
Class<? extends Annotation> bottom)
Create an annotated type factory for an accumulation checker.
|
Modifier and Type | Method and Description |
---|---|
AnnotationMirror |
createAccumulatorAnnotation(List<String> values)
Creates a new instance of the accumulator annotation that contains the elements of
values . |
AnnotationMirror |
createAccumulatorAnnotation(String value)
Creates a new instance of the accumulator annotation that contains exactly one value.
|
QualifierHierarchy |
createQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
Factory method to easily change what QualifierHierarchy is created.
|
protected TreeAnnotator |
createTreeAnnotator()
Returns a
TreeAnnotator that adds annotations to a type based on the contents of a
tree. |
List<String> |
getAccumulatedValues(AnnotationMirror anno)
Returns all the values that anno has accumulated.
|
boolean |
isAccumulatorAnnotation(AnnotationMirror anm)
Is the given annotation an accumulator annotation? Returns false if the argument is
bottom . |
boolean |
returnsThis(MethodInvocationTree tree)
Returns true if the return type of the given method invocation tree has an @This annotation
from the Returns Receiver Checker.
|
createFlowAnalysis
addAnnotationsFromDefaultQualifierForUse, addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addDefaultAnnotations, addUncheckedStandardDefaults, analyze, applyInferredAnnotations, applyQualifierParameterDefaults, applyQualifierParameterDefaults, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, constructorFromUsePreSubstitution, createAndInitQualifierDefaults, createCFGVisualizer, createDefaultForUseTypeAnnotator, createDependentTypesHelper, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, createTypeAnnotator, fromNewClass, getAnnotatedTypeLhs, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpressionString, getAnnotationFromReceiver, getAnnotationMirrorFromJavaExpressionString, getCFGVisualizer, getDependentTypesHelper, getEmptyStore, getExceptionalExitStore, getFinalLocalValues, getFirstNodeOfKindForTree, getInferredValueFor, getMethodReturnType, getMethodReturnType, getNodesForTree, getQualifierPolymorphism, getReceiverAndOffsetFromJavaExpressionString, getReceiverFromJavaExpressionString, getRegularExitStore, getResultingTypeOfConstructorMemberReference, getReturnStatementStores, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreAfter, getStoreAfter, getStoreBefore, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, handleCFGViz, methodFromUse, methodFromUsePreSubstitution, performFlowAnalysis, postAnalyze, postAsMemberOf, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUse
adaptGetClassReturnTypeToReceiver, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedDeclAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, areSameByClass, canonicalAnnotation, checkInvalidOptionsInferSignatures, containsSameByClass, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchyFactory, createQualifierUpperBounds, createSupportedTypeQualifiers, createTypeArgumentInference, createTypeHierarchy, createTypeVariableSubstitutor, declarationFromElement, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFormatter, getAnnotatedTypeFromTypeTree, getAnnotationByClass, getAnnotationFormatter, getAnnotationMirror, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiers, getCacheSize, getContext, getCurrentClassTree, getCurrentClassType, getCurrentMethodReceiver, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getDefaultTypeDeclarationBounds, getDummyAssignedTo, getElementUtils, getEnclosingElementForArtificialTree, getEnclosingType, getExpressionAndOffset, getFieldInvariantAnnotationTree, getFieldInvariantDeclarationAnnotations, getFieldInvariants, getFnInterfaceFromTree, getFunctionTypeFromTree, getFunctionTypeFromTree, getImplicitReceiverType, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getQualifierParameterHierarchies, getQualifierParameterHierarchies, getQualifierUpperBounds, getReceiverType, getSelfType, getStringType, getSupportedTypeQualifierNames, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeDeclarationBounds, getTypeHierarchy, getTypeOfExtendsImplements, getTypeVarSubstitutor, getUnboxedType, getUninferredWildcardType, getVisitorState, getWholeProgramInference, hasExplicitNoQualifierParameterInHierarchy, hasExplicitQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, initializeReflectionResolution, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isSupportedQualifier, isSupportedQualifier, isWithinConstructor, methodFromUse, negateConstant, parseStubFiles, postProcessClassTree, postTypeVarSubstitution, setEnclosingElementForArtificialTree, shouldWarnIfStubRedundantWithBytecode, toAnnotatedType, toString, type, widenToUpperBound
public final AnnotationMirror top
public final AnnotationMirror bottom
protected AccumulationAnnotatedTypeFactory(BaseTypeChecker checker, Class<? extends Annotation> accumulator, Class<? extends Annotation> bottom)
checker
- the checkeraccumulator
- the accumulator type in the hierarchy. Must be an annotation with a single
argument named "value" whose type is a String array.bottom
- the bottom type in the hierarchy, which must be a subtype of accumulator
. The bottom type should be an annotation with no arguments.public AnnotationMirror createAccumulatorAnnotation(List<String> values)
values
.values
- the arguments to the annotation. The values can contain duplicates and can be
in any order.values
's
arguments; this is top if values
is emptypublic AnnotationMirror createAccumulatorAnnotation(String value)
value
- the argument to the annotationvalue
as
its argumentpublic boolean returnsThis(MethodInvocationTree tree)
tree
- a method invocation treepublic boolean isAccumulatorAnnotation(AnnotationMirror anm)
bottom
.anm
- an annotation mirrorprotected TreeAnnotator createTreeAnnotator()
GenericAnnotatedTypeFactory
TreeAnnotator
that adds annotations to a type based on the contents of a
tree.
The default tree annotator is a ListTreeAnnotator
of the following:
PropagationTreeAnnotator
: Propagates annotations from subtrees
LiteralTreeAnnotator
: Adds annotations based on QualifierForLiterals
meta-annotations
DependentTypesTreeAnnotator
: Adapts dependent annotations based on context
Subclasses may override this method to specify additional tree annotators, for example:
new ListTreeAnnotator(super.createTreeAnnotator(), new KeyLookupTreeAnnotator(this));
createTreeAnnotator
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
public QualifierHierarchy createQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
AnnotatedTypeFactory
createQualifierHierarchy
in class AnnotatedTypeFactory
public List<String> getAccumulatedValues(AnnotationMirror anno)
anno
- an accumulator annotation; must not be bottom