Class ValueAnnotatedTypeFactory
- All Implemented Interfaces:
- AnnotationProvider
- 
Nested Class SummaryNested classes/interfaces inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactoryGenericAnnotatedTypeFactory.ScanStateNested classes/interfaces inherited from class org.checkerframework.framework.type.AnnotatedTypeFactoryAnnotatedTypeFactory.CapturedTypeVarSubstitutor, AnnotatedTypeFactory.ParameterizedExecutableType
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringFully-qualified class name ofArrayLen.static final StringFully-qualified class name ofArrayLenRange.protected final ExecutableElementThe from() element/field of an @ArrayLenRange annotation.protected final ExecutableElementThe to() element/field of an @ArrayLenRange annotation.protected final ExecutableElementThe value() element/field of an @ArrayLen annotation.final AnnotationMirrorThe canonical @BoolVal(false) annotation.final AnnotationMirrorThe canonical @BoolVal(true) annotation.static final StringFully-qualified class name ofBoolVal.protected final ExecutableElementThe value() element/field of a @BoolVal annotation.protected final AnnotationMirrorThe bottom type for this hierarchy.static final StringFully-qualified class name ofBottomVal.static final StringFully-qualified class name ofDoesNotMatchRegex.final ExecutableElementThe value() element/field of a @DoesNotMatchRegex annotation.static final StringFully-qualified class name ofDoubleVal.protected final ExecutableElementThe value() element/field of a @DoubleVal annotation.protected final ReflectiveEvaluatorHelper class that evaluates statically executable methods, constructors, and fields.static final StringFully-qualified class name ofIntRangeFromGTENegativeOne.static final StringFully-qualified class name ofIntRangeFromNonNegative.static final StringFully-qualified class name ofIntRangeFromPositive.static final StringFully-qualified class name ofIntRange.protected final ExecutableElementThe from() element/field of an @IntRange annotation.protected final ExecutableElementThe to() element/field of an @IntRange annotation.static final StringFully-qualified class name ofIntVal.protected final ExecutableElementThe value() element/field of a @IntVal annotation.static final StringFully-qualified class name ofMatchesRegex.final ExecutableElementThe value() element/field of a @MatchesRegex annotation.protected static final intThe maximum number of values allowed in an annotation's array.static final StringFully-qualified class name ofMinLen.protected final ExecutableElementThe field() element/field of a @MinLenFieldInvariant annotation.protected final ExecutableElementThe minLen() element/field of a @MinLenFieldInvariant annotation.protected final ExecutableElementThe value() element/field of a @MinLen annotation.final AnnotationMirrorThe canonical @PolyValueannotation.static final StringFully-qualified class name ofPolyValue.static final StringFully-qualified class name ofStringVal.final ExecutableElementThe value() element/field of a @StringVal annotation.static final StringFully-qualified class name ofUnknownVal.protected final AnnotationMirrorThe top type for this hierarchy.Fields inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactoryanalysis, arraysAreRelevant, cfgVisualizer, contractsUtils, defaults, dependentTypesHelper, emptyStore, exceptionalExitStores, flowByDefault, flowResult, flowResultAnalysisCaches, formalParameterPattern, hasOrIsSubchecker, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, relevantJavaTypes, returnStatementStores, scannedClasses, shouldClearSubcheckerSharedCFGs, sideEffectsUnrefineAliases, subcheckerSharedCFG, transfer, treeAnnotator, typeAnnotatorFields inherited from class org.checkerframework.framework.type.AnnotatedTypeFactoryajavaTypes, annotatedForValueElement, artificialTreeToEnclosingElementMap, capturedTypeVarSubstitutor, checker, currentFileAjavaTypes, elements, ensuresQualifierExpressionElement, ensuresQualifierIfExpressionElement, ensuresQualifierIfListTM, ensuresQualifierIfListValueElement, ensuresQualifierIfResultElement, ensuresQualifierIfTM, ensuresQualifierListTM, ensuresQualifierListValueElement, ensuresQualifierTM, fieldInvariantFieldElement, fieldInvariantQualifierElement, fromExpressionTreeCache, fromMemberTreeCache, fromTypeTreeCache, hasQualifierParameterValueElement, ignoreRawTypeArguments, loader, methodValClassNameElement, methodValMethodNameElement, methodValParamsElement, noQualifierParameterValueElement, objectGetClass, processingEnv, qualHierarchy, qualifierUpperBounds, reflectionResolver, requiresQualifierExpressionElement, requiresQualifierListTM, requiresQualifierListValueElement, requiresQualifierTM, root, shouldCache, stubTypes, trees, typeArgumentInference, typeFormatter, typeHierarchy, typeInformationPresenter, types, typeVarSubstitutor, uid, wpiOutputFormat
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidapplyInferredAnnotations(AnnotatedTypeMirror type, CFValue inferred) Applies the annotations inferred by the org.checkerframework.dataflow analysis to the typetype.Returns the canonical annotation for the passed annotation.convertArrayLenToArrayLenRange(AnnotationMirror arrayLenAnno) Converts an@ArrayLenannotation to an@ArrayLenRangeannotation.convertIntRangeToIntVal(AnnotationMirror intRangeAnno) Convert an@IntRangeannotation to an@IntValannotation, or to UNKNOWNVAL if the input is too wide to be represented as an@IntVal.convertIntValToIntRange(AnnotationMirror intValAnno) Converts an@IntValannotation to an@IntRangeannotation.createArrayLenAnnotation(@Nullable List<Integer> values) Returns aArrayLenannotation using the values.createArrayLenRangeAnnotation(int from, int to) Create an@ArrayLenRangeannotation from the two (inclusive) bounds.Create an@ArrayLenRangeannotation from the range.createBooleanAnnotation(@Nullable List<Boolean> values) Returns aBoolValannotation using the values.createCharAnnotation(@Nullable List<Character> values) Returns aIntValannotation using the values.Creates anDoesNotMatchRegexannotation for the given regular expressions.createDoubleAnnotation(@Nullable List<Double> values) Returns aDoubleValannotation using the values.createDoubleValAnnotation(@Nullable List<Double> values) Returns aDoubleValannotation using the values.Returns the appropriate transfer function that is used for the given org.checkerframework.dataflow analysis.createIntRangeAnnotation(Range range) Create an@IntRangeor@IntValannotation from the range.createIntValAnnotation(@Nullable List<Long> values) createMatchesRegexAnnotation(@Nullable List<@Regex String> regexes) Creates anMatchesRegexannotation for the given regular expressions.createNumberAnnotationMirror(@Nullable List<Number> values) Returns an annotation that represents the given set of values.protected QualifierHierarchyReturns theQualifierHierarchyto be used by this checker.createStringAnnotation(@Nullable List<String> values) Returns aStringValannotation using the values.protected Set<Class<? extends Annotation>> Returns a mutable set of annotation classes that are supported by a checker.protected TreeAnnotatorReturns aTreeAnnotatorthat adds annotations to a type based on the contents of a tree.protected TypeAnnotatorReturns aDefaultForTypeAnnotatorthat adds annotations to a type based on the content of the type itself.protected TypeHierarchyCreates the type hierarchy to be used by this factory.getArrayLength(@PolyNull AnnotationMirror arrayAnno) Returns the set of possible array lengths as a sorted list with no duplicate values.protected intGets the from() element/field out of an ArrayLenRange annotation.protected intGets the to() element/field out of an ArrayLenRange annotation.getBooleanValue(@Nullable AnnotationMirror boolAnno) Returns the single possible boolean value, or null if there is not exactly one possible value.getBooleanValues(@Nullable AnnotationMirror boolAnno) Returns the set of possible boolean values as a sorted list with no duplicate values.getCharValues(@PolyNull AnnotationMirror intAnno) Returns the set of possible values as a sorted list with no duplicate values.getDoesNotMatchRegexValues(@PolyNull AnnotationMirror doesNotMatchRegexAnno) Returns the set of possible regexes as a sorted list with no duplicate values.getDoubleValues(@PolyNull AnnotationMirror doubleAnno) Returns the set of possible values as a sorted list with no duplicate values.getDummyAssignedTo(ExpressionTree expressionTree) Returns the annotation type mirror for the type ofexpressionTreewith default annotations applied.protected Set<Class<? extends Annotation>> Returns the set of classes of field invariant annotations.getFieldInvariants(TypeElement element) Returns the field invariants for the given class, as expressed by the user in@FieldInvariantmethod annotations.longFinds the appropriate value for thefromvalue of an annotated type mirror containing anIntRangeannotation.protected longgetIntRangeFromValue(AnnotationMirror intRangeAnno) Gets the from() element/field out of an IntRange annotation.protected longgetIntRangeFromValue(AnnotationMirror intRangeAnno, long defaultValue) Gets the from() element/field out of an IntRange annotation.protected longgetIntRangeToValue(AnnotationMirror intRangeAnno) Gets the to() element/field out of an IntRange annotation.protected longgetIntRangeToValue(AnnotationMirror intRangeAnno, long defaultValue) Gets the to() element/field out of an IntRange annotation.getIntValues(@PolyNull AnnotationMirror intAnno) Returns the set of possible values as a sorted list with no duplicate values.getMatchesRegexValues(@PolyNull AnnotationMirror matchesRegexAnno) Returns the set of possible regexes as a sorted list with no duplicate values.getMaxLenValue(@Nullable AnnotationMirror annotation) Used to find the maximum length of an array.Returns the smallest possible value that an integral annotation might take on.intgetMinLenFromString(String sequenceExpression, Tree tree, TreePath currentPath) Returns the minimum length of an array expression or 0 if the min length is unknown.intgetMinLenValue(@Nullable AnnotationMirror annotation) Used to find the minimum length of an array, which is useful for array bounds checking.intintgetMinLenValue(AnnotationMirrorSet annotations) Returns the minimum length of an array.protected intGets the value() element/field out of a MinLen annotation.getRange(@Nullable AnnotationMirror rangeAnno) Returns aRangebounded by the values specified in the given@Rangeannotation.getStringValues(@PolyNull AnnotationMirror stringAnno) Returns the set of possible values as a sorted list with no duplicate values.longFinds the appropriate value for thetovalue of an annotated type mirror containing anIntRangeannotation.getWidenedAnnotations(AnnotationMirrorSet annos, TypeKind typeKind, TypeKind widenedTypeKind) Returns annotations applicable to typewidenedTypeKind, that are copied or adapted fromannos.booleanisImmutable(TypeMirror type) A fact about an array, such as its length, cannot be changed via side effects to the array.booleanisIntRange(AnnotationMirror anno) Returns true ifannois anIntRange,IntRangeFromPositive,IntRangeFromNonNegative, orIntRangeFromGTENegativeOne.booleanisIntRange(AnnotationMirrorSet anmSet) Returns true ifisIntRange(AnnotationMirror)returns true for any annotation in the given set.methodFromUse(ExpressionTree tree, ExecutableElement methodElt, AnnotatedTypeMirror receiverType, boolean inferTypeArgs) Creates array length annotations for the result of the Enum.values() method, which is the number of possible values of the enum.Methods inherited from class org.checkerframework.common.basetype.BaseAnnotatedTypeFactorycreateFlowAnalysisMethods inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactoryaddAnnotationsFromDefaultForType, addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotationsForWarnRedundant, addDefaultAnnotations, addSharedCFGForTree, addUncheckedStandardDefaults, analyze, annotationsForIrrelevantJavaType, applyQualifierParameterDefaults, applyQualifierParameterDefaults, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, constructorFromUsePreSubstitution, createAndInitQualifierDefaults, createCFGVisualizer, createContractsFromMethod, createDefaultForTypeAnnotator, createDefaultForUseTypeAnnotator, createDependentTypesHelper, createQualifierDefaults, createQualifierPolymorphism, createRequiresOrEnsuresQualifier, getAnnotatedTypeLhs, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpression, getAnnotationFromJavaExpressionString, getAnnotationMirrorFromJavaExpressionString, getAnnotationsFromJavaExpression, getCFGVisualizer, getContractAnnotations, getContractAnnotations, getContractExpressions, getContractsFromMethod, getDefaultAnnotations, getDefaultAnnotationsForWarnRedundant, getDefaultForTypeAnnotator, getDefaultValueAnnotatedType, getDependentTypesHelper, getEmptyStore, getEnsuresQualifierIfResult, getExceptionalExitStore, getExplicitNewClassAnnos, getExplicitNewClassClassTypeArgs, getExpressionAndOffsetFromJavaExpressionString, getFinalLocalValues, getFirstNodeOfKindForTree, getInferredValueFor, getMethodReturnType, getNodesForTree, getPostconditionAnnotations, getPostconditionAnnotations, getPostconditionAnnotations, getPreconditionAnnotations, getPreconditionAnnotations, getPreconditionAnnotations, getPreOrPostconditionAnnotations, getQualifierPolymorphism, getRegularExitStore, getReturnStatementStores, getSharedCFGForTree, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreAfter, getStoreAfter, getStoreBefore, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, getTypeFactoryOfSubcheckerOrNull, handleCFGViz, irrelevantExtraMessage, isIgnoredExceptionType, isRelevant, isRelevant, isRelevantImpl, isUnreachable, methodFromUse, methodFromUsePreSubstitution, parseJavaExpressionString, performFlowAnalysis, postAnalyze, postAsMemberOf, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUseMethods inherited from class org.checkerframework.framework.type.AnnotatedTypeFactoryadaptGetClassReturnTypeToReceiver, addAliasedDeclAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, applyCaptureConversion, applyCaptureConversion, applyUnboxing, areSameByClass, binaryTreeArgTypes, binaryTreeArgTypes, checkInvalidOptionsInferSignatures, compoundAssignmentTreeArgTypes, constructorFromUse, constructorFromUseWithoutTypeArgInference, containsCapturedTypes, containsSameByClass, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierUpperBounds, createTypeArgumentInference, createTypeInformationPresenter, createTypeVariableSubstitutor, declarationFromElement, doesAnnotatedForApplyToThisChecker, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFormatter, getAnnotatedTypeFromTypeTree, getAnnotationByClass, getAnnotationFormatter, getAnnotationMirror, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiers, getCacheSize, getChecker, getCheckerNames, getContractExpressions, getContractListValues, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getDefaultTypeDeclarationBounds, getElementUtils, getEnclosingClassOrMethod, getEnclosingElementForArtificialTree, getEnclosingSubType, getEnclosingType, getEnumConstructorQualifiers, getExpressionAndOffset, getFieldInvariantAnnotationTree, getFnInterfaceFromTree, getFunctionTypeFromTree, getFunctionTypeFromTree, getImplicitReceiverType, getIterableElementType, getIterableElementType, getMethodReturnType, getNarrowedAnnotations, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getQualifierParameterHierarchies, getQualifierParameterHierarchies, getQualifierUpperBounds, getReceiverType, getResultingTypeOfConstructorMemberReference, getSelfType, getStringType, getSupportedTypeQualifierNames, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeDeclarationBounds, getTypeHierarchy, getTypeOfExtendsImplements, getTypeVarSubstitutor, getUnboxedType, getVisitorTreePath, getWholeProgramInference, getWidenedType, getWidenedType, hasExplicitNoQualifierParameterInHierarchy, hasExplicitQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, initializeAtm, initializeReflectionResolution, isDeterministic, isFromByteCode, isFromStubFile, isSideEffectFree, isSupportedQualifier, isSupportedQualifier, isSupportedQualifier, isTop, isWithinConstructor, logGat, makeConditionConsistentWithOtherMethod, mergeAnnotationFileAnnosIntoType, methodFromUse, methodFromUse, methodFromUseWithoutTypeArgInference, methodFromUseWithoutTypeArgInference, negateConstant, order, parseAnnotationFiles, postProcessClassTree, replaceAnnotations, replaceAnnotations, setEnclosingElementForArtificialTree, setVisitorTreePath, shouldWarnIfStubRedundantWithBytecode, toAnnotatedType, toString, type, wpiAdjustForUpdateField, wpiAdjustForUpdateNonField, wpiPrepareMethodForWriting, wpiPrepareMethodForWriting, wpiShouldInferTypesForReceivers
- 
Field Details- 
UNKNOWN_NAMEFully-qualified class name ofUnknownVal.- See Also:
 
- 
BOTTOMVAL_NAMEFully-qualified class name ofBottomVal.- See Also:
 
- 
POLY_NAMEFully-qualified class name ofPolyValue.- See Also:
 
- 
ARRAYLEN_NAMEFully-qualified class name ofArrayLen.- See Also:
 
- 
BOOLVAL_NAMEFully-qualified class name ofBoolVal.- See Also:
 
- 
DOUBLEVAL_NAMEFully-qualified class name ofDoubleVal.- See Also:
 
- 
INTVAL_NAMEFully-qualified class name ofIntVal.- See Also:
 
- 
STRINGVAL_NAMEFully-qualified class name ofStringVal.- See Also:
 
- 
ARRAYLENRANGE_NAMEFully-qualified class name ofArrayLenRange.- See Also:
 
- 
INTRANGE_NAMEFully-qualified class name ofIntRange.- See Also:
 
- 
INTRANGE_FROMGTENEGONE_NAMEFully-qualified class name ofIntRangeFromGTENegativeOne.- See Also:
 
- 
INTRANGE_FROMNONNEG_NAMEFully-qualified class name ofIntRangeFromNonNegative.- See Also:
 
- 
INTRANGE_FROMPOS_NAMEFully-qualified class name ofIntRangeFromPositive.- See Also:
 
- 
MINLEN_NAMEFully-qualified class name ofMinLen.- See Also:
 
- 
MATCHES_REGEX_NAMEFully-qualified class name ofMatchesRegex.- See Also:
 
- 
DOES_NOT_MATCH_REGEX_NAMEFully-qualified class name ofDoesNotMatchRegex.- See Also:
 
- 
MAX_VALUESprotected static final int MAX_VALUESThe maximum number of values allowed in an annotation's array.- See Also:
 
- 
UNKNOWNVALThe top type for this hierarchy.
- 
BOTTOMVALThe bottom type for this hierarchy.
- 
POLYThe canonical @PolyValueannotation.
- 
BOOLEAN_TRUEThe canonical @BoolVal(true) annotation.
- 
BOOLEAN_FALSEThe canonical @BoolVal(false) annotation.
- 
arrayLenValueElementThe value() element/field of an @ArrayLen annotation.
- 
arrayLenRangeFromElementThe from() element/field of an @ArrayLenRange annotation.
- 
arrayLenRangeToElementThe to() element/field of an @ArrayLenRange annotation.
- 
boolValValueElementThe value() element/field of a @BoolVal annotation.
- 
doubleValValueElementThe value() element/field of a @DoubleVal annotation.
- 
intRangeFromElementThe from() element/field of an @IntRange annotation.
- 
intRangeToElementThe to() element/field of an @IntRange annotation.
- 
intValValueElementThe value() element/field of a @IntVal annotation.
- 
matchesRegexValueElementThe value() element/field of a @MatchesRegex annotation.
- 
doesNotMatchRegexValueElementThe value() element/field of a @DoesNotMatchRegex annotation.
- 
minLenValueElementThe value() element/field of a @MinLen annotation.
- 
minLenFieldInvariantFieldElementThe field() element/field of a @MinLenFieldInvariant annotation.
- 
minLenFieldInvariantMinLenElementThe minLen() element/field of a @MinLenFieldInvariant annotation.
- 
stringValValueElementThe value() element/field of a @StringVal annotation.
- 
evaluatorHelper class that evaluates statically executable methods, constructors, and fields.
 
- 
- 
Constructor Details- 
ValueAnnotatedTypeFactory
 
- 
- 
Method Details- 
applyInferredAnnotationsDescription copied from class:GenericAnnotatedTypeFactoryApplies the annotations inferred by the org.checkerframework.dataflow analysis to the typetype.- Overrides:
- applyInferredAnnotationsin class- GenericAnnotatedTypeFactory<CFValue,- CFStore, - CFTransfer, - CFAnalysis> 
- Parameters:
- type- the type to modify
- inferred- the inferred annotations to apply
 
- 
canonicalAnnotationDescription copied from class:AnnotatedTypeFactoryReturns the canonical annotation for the passed annotation. Returns null if the passed annotation is not an alias of a canonical one in the framework.A canonical annotation is the internal annotation that will be used by the Checker Framework in the aliased annotation's place. - Overrides:
- canonicalAnnotationin class- AnnotatedTypeFactory
- Parameters:
- anno- the qualifier to check for an alias
- Returns:
- the canonical annotation, or null if none exists
 
- 
createSupportedTypeQualifiersDescription copied from class:AnnotatedTypeFactoryReturns a mutable set of annotation classes that are supported by a checker.Subclasses may override this method to return a mutable set of their supported type qualifiers through one of the 5 approaches shown below. Subclasses should not call this method; they should call AnnotatedTypeFactory.getSupportedTypeQualifiers()instead.By default, a checker supports all annotations located in a subdirectory called qual that's located in the same directory as the checker. Note that only annotations defined with the @Target({ElementType.TYPE_USE})meta-annotation (and optionally with the additional value ofElementType.TYPE_PARAMETER, but no otherElementTypevalues) are automatically considered as supported annotations.To support a different set of annotations than those in the qual subdirectory, or that have other ElementTypevalues, see examples below.In total, there are 5 ways to indicate annotations that are supported by a checker: - Only support annotations located in a checker's qual directory:
       This is the default behavior. Simply place those annotations within the qual directory. 
- Support annotations located in a checker's qual directory and a list of other
       annotations:
       Place those annotations within the qual directory, and override AnnotatedTypeFactory.createSupportedTypeQualifiers()by callingAnnotatedTypeFactory.getBundledTypeQualifiers(Class...)with a varargs parameter list of the other annotations. Code example:@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() { return getBundledTypeQualifiers(Regex.class, PartialRegex.class, RegexBottom.class, UnknownRegex.class); }
- Supporting only annotations that are explicitly listed: Override AnnotatedTypeFactory.createSupportedTypeQualifiers()and return a mutable set of the supported annotations. Code example:
 The set of qualifiers returned by@Override protected Set<Class<? extends Annotation>> createSupportedTypeQualifiers() { return new HashSet<Class<? extends Annotation>>( Arrays.asList(A.class, B.class)); }AnnotatedTypeFactory.createSupportedTypeQualifiers()must be a fresh, mutable set. The methodsAnnotatedTypeFactory.getBundledTypeQualifiers(Class...)must return a fresh, mutable set
 - Overrides:
- createSupportedTypeQualifiersin class- AnnotatedTypeFactory
- Returns:
- the type qualifiers supported this processor, or an empty set if none
 
- Only support annotations located in a checker's qual directory:
       
- 
createFlowTransferFunctionpublic CFTransfer createFlowTransferFunction(CFAbstractAnalysis<CFValue, CFStore, CFTransfer> analysis) Description copied from class:GenericAnnotatedTypeFactoryReturns the appropriate transfer function that is used for the given org.checkerframework.dataflow analysis.This implementation uses the checker naming convention to create the appropriate transfer function. If no transfer function is found, it returns an instance of CFTransfer.Subclasses have to override this method to create the appropriate transfer function if they do not follow the checker naming convention. - Overrides:
- createFlowTransferFunctionin class- GenericAnnotatedTypeFactory<CFValue,- CFStore, - CFTransfer, - CFAnalysis> 
- Parameters:
- analysis- a dataflow analysis
- Returns:
- a new transfer function
 
- 
createQualifierHierarchyDescription copied from class:AnnotatedTypeFactoryReturns theQualifierHierarchyto be used by this checker.The implementation builds the type qualifier hierarchy for the AnnotatedTypeFactory.getSupportedTypeQualifiers()using the meta-annotations found in them. The current implementation returns an instance ofNoElementQualifierHierarchy.Subclasses must override this method if their qualifiers have elements; the method must return an implementation of QualifierHierarchy, such asElementQualifierHierarchy.- Overrides:
- createQualifierHierarchyin class- AnnotatedTypeFactory
- Returns:
- a QualifierHierarchy for this type system
 
- 
createTypeHierarchyDescription copied from class:AnnotatedTypeFactoryCreates the type hierarchy to be used by this factory.Subclasses may override this method to specify new type-checking rules beyond the typical Java subtyping rules. - Overrides:
- createTypeHierarchyin class- AnnotatedTypeFactory
- Returns:
- the type relations class to check type subtyping
 
- 
createTypeAnnotatorDescription copied from class:GenericAnnotatedTypeFactoryReturns aDefaultForTypeAnnotatorthat adds annotations to a type based on the content of the type itself.Subclass may override this method. The default type annotator is a ListTypeAnnotatorof the following:- IrrelevantTypeAnnotator: Adds top to types not listed in the- @- RelevantJavaTypesannotation on the checker.
- PropagationTypeAnnotator: Propagates annotation onto wildcards.
 - Overrides:
- createTypeAnnotatorin class- GenericAnnotatedTypeFactory<CFValue,- CFStore, - CFTransfer, - CFAnalysis> 
- Returns:
- a type annotator
 
- 
getFieldInvariantsDescription copied from class:AnnotatedTypeFactoryReturns the field invariants for the given class, as expressed by the user in@FieldInvariantmethod annotations.Subclasses may implement their own field invariant annotations if @FieldInvariantis not expressive enough. They must override this method to properly create AnnotationMirror and also overrideAnnotatedTypeFactory.getFieldInvariantDeclarationAnnotations()to return their field invariants.- Overrides:
- getFieldInvariantsin class- AnnotatedTypeFactory
- Parameters:
- element- class for which to get invariants
- Returns:
- field invariants for element
 
- 
getFieldInvariantDeclarationAnnotationsDescription copied from class:AnnotatedTypeFactoryReturns the set of classes of field invariant annotations.- Overrides:
- getFieldInvariantDeclarationAnnotationsin class- AnnotatedTypeFactory
- Returns:
- the set of classes of field invariant annotations
 
- 
methodFromUseprotected AnnotatedTypeFactory.ParameterizedExecutableType methodFromUse(ExpressionTree tree, ExecutableElement methodElt, AnnotatedTypeMirror receiverType, boolean inferTypeArgs) Creates array length annotations for the result of the Enum.values() method, which is the number of possible values of the enum.- Overrides:
- methodFromUsein class- AnnotatedTypeFactory
- Parameters:
- tree- either a MethodInvocationTree or a MemberReferenceTree
- methodElt- the element of the referenced method
- receiverType- the type of the receiver
- inferTypeArgs- true if type arguments should be inferred
- Returns:
- the type of the invoked method
 
- 
getWidenedAnnotationspublic AnnotationMirrorSet getWidenedAnnotations(AnnotationMirrorSet annos, TypeKind typeKind, TypeKind widenedTypeKind) Description copied from class:AnnotatedTypeFactoryReturns annotations applicable to typewidenedTypeKind, that are copied or adapted fromannos.- Overrides:
- getWidenedAnnotationsin class- AnnotatedTypeFactory
- Parameters:
- annos- annotations to widen, from a primitive or boxed primitive
- typeKind- primitive type to widen
- widenedTypeKind- target for the returned annotations; a primitive type that is wider than- typeKind(in the sense of JLS 5.1.2)
- Returns:
- result of converting annosfromtypeKindtowidenedTypeKind
 
- 
getFromValueFromIntRangeFinds the appropriate value for thefromvalue of an annotated type mirror containing anIntRangeannotation.- Parameters:
- atm- an annotated type mirror that contains an- IntRangeannotation
- Returns:
- either the from value from the passed int range annotation, or the minimum value of the domain of the underlying type (i.e. Integer.MIN_VALUE if the underlying type is int)
 
- 
getToValueFromIntRangeFinds the appropriate value for thetovalue of an annotated type mirror containing anIntRangeannotation.- Parameters:
- atm- an annotated type mirror that contains an- IntRangeannotation
- Returns:
- either the to value from the passed int range annotation, or the maximum value of the domain of the underlying type (i.e. Integer.MAX_VALUE if the underlying type is int)
 
- 
getIntRangeFromValueGets the from() element/field out of an IntRange annotation. The from() element/field must exist. Clients should callgetFromValueFromIntRange(org.checkerframework.framework.type.AnnotatedTypeMirror)if it might not exist.- Parameters:
- intRangeAnno- an IntRange annotation
- Returns:
- its from() element/field
 
- 
getIntRangeFromValueGets the from() element/field out of an IntRange annotation. The from() element/field must exist. Clients should callgetFromValueFromIntRange(org.checkerframework.framework.type.AnnotatedTypeMirror)if it might not exist.- Parameters:
- intRangeAnno- an IntRange annotation
- defaultValue- the value to return if there is no from() element/field
- Returns:
- its from() element/field
 
- 
getIntRangeToValueGets the to() element/field out of an IntRange annotation. The to() element/field must exist. Clients should callgetToValueFromIntRange(org.checkerframework.framework.type.AnnotatedTypeMirror)if it might not exist.- Parameters:
- intRangeAnno- an IntRange annotation
- defaultValue- the value to retur if there is no to() element/field
- Returns:
- its to() element/field
 
- 
getIntRangeToValueGets the to() element/field out of an IntRange annotation. The to() element/field must exist. Clients should callgetToValueFromIntRange(org.checkerframework.framework.type.AnnotatedTypeMirror)if it might not exist.- Parameters:
- intRangeAnno- an IntRange annotation
- Returns:
- its to() element/field
 
- 
getArrayLenRangeFromValueGets the from() element/field out of an ArrayLenRange annotation.- Parameters:
- anno- an ArrayLenRange annotation
- Returns:
- its from() element/field
 
- 
getArrayLenRangeToValueGets the to() element/field out of an ArrayLenRange annotation.- Parameters:
- anno- an ArrayLenRange annotation
- Returns:
- its to() element/field
 
- 
getMinLenValueValueGets the value() element/field out of a MinLen annotation.- Parameters:
- anno- a MinLen annotation
- Returns:
- its value() element/field
 
- 
createTreeAnnotatorDescription copied from class:GenericAnnotatedTypeFactoryReturns aTreeAnnotatorthat adds annotations to a type based on the contents of a tree.The default tree annotator is a ListTreeAnnotatorof the following:- PropagationTreeAnnotator: Propagates annotations from subtrees
- LiteralTreeAnnotator: Adds annotations based on- QualifierForLiteralsmeta-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)); - Overrides:
- createTreeAnnotatorin class- GenericAnnotatedTypeFactory<CFValue,- CFStore, - CFTransfer, - CFAnalysis> 
- Returns:
- a tree annotator
 
- 
createIntValAnnotationReturns aIntValorIntRangeannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. If the number ofvaluesis greater than MAX_VALUES, return anIntRange. In other cases, the values are sorted and duplicates are removed before anIntValis created.- Parameters:
- values- list of longs; duplicates are allowed and the values may be in any order
- Returns:
- an annotation depends on the values
 
- 
convertIntRangeToIntValConvert an@IntRangeannotation to an@IntValannotation, or to UNKNOWNVAL if the input is too wide to be represented as an@IntVal.- Parameters:
- intRangeAnno- an- @IntRangeannotation
- Returns:
- an @IntValannotation corresponding to the argument
 
- 
createDoubleValAnnotationReturns aDoubleValannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created.- Parameters:
- values- list of doubles; duplicates are allowed and the values may be in any order
- Returns:
- a DoubleValannotation using the values
 
- 
createStringAnnotationReturns aStringValannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created. If values is larger than the max number of values allowed (10 by default), then anArrayLenor anArrayLenRangeannotation is returned.- Parameters:
- values- list of strings; duplicates are allowed and the values may be in any order
- Returns:
- a StringValannotation using the values
 
- 
createArrayLenAnnotationReturns aArrayLenannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created. If values is larger than the max number of values allowed (10 by default), then anArrayLenRangeannotation is returned.- Parameters:
- values- list of integers; duplicates are allowed and the values may be in any order
- Returns:
- a ArrayLenannotation using the values
 
- 
createBooleanAnnotationReturns aBoolValannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created.- Parameters:
- values- list of booleans; duplicates are allowed and the values may be in any order
- Returns:
- a BoolValannotation using the values
 
- 
createCharAnnotationReturns aIntValannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created.- Parameters:
- values- list of characters; duplicates are allowed and the values may be in any order
- Returns:
- a IntValannotation using the values
 
- 
createDoubleAnnotationReturns aDoubleValannotation using the values. Ifvaluesis null, then UnknownVal is returned; ifvaluesis empty, then bottom is returned. The values are sorted and duplicates are removed before the annotation is created.- Parameters:
- values- list of doubleacters; duplicates are allowed and the values may be in any order
- Returns:
- a IntValannotation using the values
 
- 
createNumberAnnotationMirrorReturns an annotation that represents the given set of values.- Parameters:
- values- a homogeneous list: every element of it has the same class. This method does not modify or store it.
- Returns:
- an annotation that represents the given set of values
 
- 
createIntRangeAnnotationCreate an@IntRangeor@IntValannotation from the range. May return BOTTOMVAL or UNKNOWNVAL.
- 
createArrayLenRangeAnnotationCreate an@ArrayLenRangeannotation from the two (inclusive) bounds. Does not return BOTTOMVAL or UNKNOWNVAL.
- 
createArrayLenRangeAnnotationCreate an@ArrayLenRangeannotation from the range. May return BOTTOMVAL or UNKNOWNVAL.
- 
createMatchesRegexAnnotationCreates anMatchesRegexannotation for the given regular expressions.- Parameters:
- regexes- a list of Java regular expressions
- Returns:
- a MatchesRegex annotation with those values
 
- 
createDoesNotMatchRegexAnnotationCreates anDoesNotMatchRegexannotation for the given regular expressions.- Parameters:
- regexes- a list of Java regular expressions
- Returns:
- a DoesNotMatchRegex annotation with those values
 
- 
convertArrayLenToArrayLenRangeConverts an@ArrayLenannotation to an@ArrayLenRangeannotation.- Parameters:
- arrayLenAnno- an ArrayLen annotation
- Returns:
- an ArrayLenRange annotation representing the bounds of the given ArrayLen annotation
 
- 
convertIntValToIntRangeConverts an@IntValannotation to an@IntRangeannotation.
- 
getRangeReturns aRangebounded by the values specified in the given@Rangeannotation. Also returns an appropriate range if an@IntValannotation is passed. Returnsnullif the annotation is null or if the annotation is not anIntRange,IntRangeFromPositive,IntVal, orArrayLenRange.- Parameters:
- rangeAnno- a- @Rangeannotation
- Returns:
- the Rangethat the annotation represents
 
- 
getIntValuesReturns the set of possible values as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.The method returns a list of Longbut is namedgetIntValuesbecause it supports the@IntValannotation.- Parameters:
- intAnno- an- @IntValannotation, or null
- Returns:
- the possible values, deduplicated and sorted
 
- 
getDoubleValuesReturns the set of possible values as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.- Parameters:
- doubleAnno- a- @DoubleValannotation, or null
- Returns:
- the possible values, deduplicated and sorted
 
- 
getArrayLengthReturns the set of possible array lengths as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.- Parameters:
- arrayAnno- an- @ArrayLenannotation, or null
- Returns:
- the possible array lengths, deduplicated and sorted
 
- 
getCharValuesReturns the set of possible values as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.- Parameters:
- intAnno- an- @IntValannotation, or null
- Returns:
- the values represented by the given @IntValannotation
 
- 
getBooleanValueReturns the single possible boolean value, or null if there is not exactly one possible value.- Parameters:
- boolAnno- a- @BoolValannotation, or null
- Returns:
- the single possible boolean value, on null if that is not the case
- See Also:
 
- 
getBooleanValuesReturns the set of possible boolean values as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.- Parameters:
- boolAnno- a- @BoolValannotation, or null
- Returns:
- a singleton or empty list of possible boolean values, or null
 
- 
getStringValuesReturns the set of possible values as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no constant-value annotation so the argument is null.- Parameters:
- stringAnno- a- @StringValannotation, or null
- Returns:
- the possible values, deduplicated and sorted
 
- 
getMatchesRegexValuesReturns the set of possible regexes as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no @MatchesRegex annotation so the argument is null.- Parameters:
- matchesRegexAnno- a- @MatchesRegexannotation, or null
- Returns:
- the possible values, deduplicated and sorted
 
- 
getDoesNotMatchRegexValuespublic @PolyNull List<String> getDoesNotMatchRegexValues(@PolyNull AnnotationMirror doesNotMatchRegexAnno) Returns the set of possible regexes as a sorted list with no duplicate values. Returns the empty list if no values are possible (for dead code). Returns null if any value is possible -- that is, if no estimate can be made -- and this includes when there is no @DoesNotMatchRegex annotation so the argument is null.- Parameters:
- doesNotMatchRegexAnno- a- @DoesNotMatchRegexannotation, or null
- Returns:
- the possible values, deduplicated and sorted
 
- 
isIntRangeReturns true ifisIntRange(AnnotationMirror)returns true for any annotation in the given set.- Parameters:
- anmSet- a set of annotations
- Returns:
- true if any annotation is IntRangeor related
 
- 
isIntRangeReturns true ifannois anIntRange,IntRangeFromPositive,IntRangeFromNonNegative, orIntRangeFromGTENegativeOne.- Parameters:
- anno- annotation mirror
- Returns:
- true if annois anIntRange,IntRangeFromPositive,IntRangeFromNonNegative, orIntRangeFromGTENegativeOne
 
- 
getMinLenValue
- 
getMaxLenValueUsed to find the maximum length of an array. Returns null if there is no minimum length known, or if the passed annotation is null.
- 
getMinLenValueUsed to find the minimum length of an array, which is useful for array bounds checking. Returns 0 if there is no minimum length known, or if the passed annotation is null.Note that this routine handles actual MinLenannotations, because it is called bycanonicalAnnotation(AnnotationMirror), which transformsMinLenannotations intoArrayLenRangeannotations.
- 
getMinLenValueReturns the minimum length of an array.- Parameters:
- annotations- the annotations on the array expression
- Returns:
- the minimum length of an array
 
- 
getMinimumIntegralValueReturns the smallest possible value that an integral annotation might take on. The passedAnnotatedTypeMirrorshould contain either an@IntRangeannotation or an@IntValannotation. Returns null if it does not.- Parameters:
- atm- annotated type
- Returns:
- the smallest possible integral for which the atmcould be the type
 
- 
getMinLenFromStringReturns the minimum length of an array expression or 0 if the min length is unknown.- Parameters:
- sequenceExpression- a Java expression
- tree- expression tree or variable declaration
- currentPath- path to local scope
- Returns:
- min length of sequenceExpression or 0
 
- 
getDummyAssignedToReturns the annotation type mirror for the type ofexpressionTreewith default annotations applied.- Overrides:
- getDummyAssignedToin class- AnnotatedTypeFactory
- Parameters:
- expressionTree- an expression which has no assignment context and for which type arguments need to be inferred
- Returns:
- nullor an annotated type mirror that inferrence should pretend- expressionTreeis assigned to
 
- 
isImmutableA fact about an array, such as its length, cannot be changed via side effects to the array.- Overrides:
- isImmutablein class- AnnotatedTypeFactory
- Parameters:
- type- type to test
- Returns:
- true if the type is immutable
 
 
-