Class IteratorAnnotatedTypeFactory
- All Implemented Interfaces:
AnnotationProvider
IteratorChecker.-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
GenericAnnotatedTypeFactory.ClassAndStore<S>, GenericAnnotatedTypeFactory.JavaExpressionAndOffset, GenericAnnotatedTypeFactory.LambdaAndStore<S>, GenericAnnotatedTypeFactory.ScanStateNested classes/interfaces inherited from class org.checkerframework.framework.type.AnnotatedTypeFactory
AnnotatedTypeFactory.AnnotationWithMetaAnnotation, AnnotatedTypeFactory.BinaryArgTypes, AnnotatedTypeFactory.CapturedTypeVarSubstitutor, AnnotatedTypeFactory.ExpressionAndOffset, AnnotatedTypeFactory.FnInterfaceAndType, AnnotatedTypeFactory.ParameterizedExecutableType -
Field Summary
Fields inherited from class org.checkerframework.checker.modifiability.ModifiabilityBaseAnnotatedTypeFactory
collectionErasure, ITERATOR_POLY_MOD, iteratorErasure, listIteratorErasure, mapEntryErasure, mapErasureFields inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
analysis, arrayTypesAreRelevant, 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.AnnotatedTypeFactory
ajavaTypes, annotatedForValueElement, artificialTreeToEnclosingElementMap, capturedTypeVarSubstitutor, checker, currentFileAjavaTypes, debugGat, doesNotUnrefineReceiverValueElement, 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, sideEffectsOnlyValueElement, stubTypes, trees, typeArgumentInference, typeFormatter, typeHierarchy, typeInformationPresenter, types, typeVarSubstitutor, uid, wpiOutputFormat -
Constructor Summary
ConstructorsConstructorDescriptionCreates an IteratorAnnotatedTypeFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected Set<Class<? extends Annotation>> Returns a mutable set of annotation classes that are supported by a checker.protected booleanReturns true if this checker's hierarchy is one of the capabilities that the whole-modifiability aliases (@Modifiable,@Unmodifiable,@MaybeModifiable,@UnmodifiableParam, and@PolyModifiable) expand into.protected booleanReturns true if this checker's hierarchy contains a negative qualifier, such as@Ungrowable.protected AnnotationMirrorReturns the negative capability qualifier, such as@Ungrowable.protected AnnotationMirrorReturns the polymorphic capability qualifier, such as@PolyGrowable.protected AnnotationMirrorReturns the positive capability qualifier, such as@Growable.protected AnnotationMirrorReturns the top qualifier of this checker's hierarchy, such as@MaybeGrowable.protected List<TypeMirror> Returns erased types whose every subtype has this checker's capability, unlessModifiabilityBaseAnnotatedTypeFactory.typeLacksCapability(javax.lang.model.type.TypeMirror)holds of the subtype.Methods inherited from class org.checkerframework.checker.modifiability.ModifiabilityBaseAnnotatedTypeFactory
canonicalAnnotation, canonicalAnnotation, erasureOf, methodFromUse, polyLacksCapability, refinedIteratorResultBound, refineIteratorReturnType, refineReturnTypeForPreservesModifiability, typeLacksCapabilityMethods inherited from class org.checkerframework.common.basetype.BaseAnnotatedTypeFactory
createFlowAnalysisMethods inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
addAnnotationsFromDefaultForType, addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotationsForWarnRedundant, addDefaultAnnotations, addSharedCFGForTree, addUncheckedStandardDefaults, analyze, annotationsForIrrelevantJavaType, applyInferredAnnotations, applyQualifierParameterDefaults, applyQualifierParameterDefaults, arrayTypesAreRelevant, artificialTreeMap, checkForDefaultQualifierInHierarchy, constructorFromUse, constructorFromUsePreSubstitution, createAndInitQualifierDefaults, createCFGVisualizer, createContractsFromMethod, createDefaultForTypeAnnotator, createDefaultForUseTypeAnnotator, createDependentTypesHelper, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, createRequiresOrEnsuresQualifier, createTreeAnnotator, createTypeAnnotator, 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, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, getTypeFactoryOfSubcheckerOrNull, handleCFGViz, irrelevantExtraMessage, isIgnoredExceptionType, isRelevant, isRelevant, isRelevantImpl, isUnreachable, methodFromUsePreSubstitution, parseJavaExpressionString, performFlowAnalysisForClass, performFlowAnalysisForClassOnce, postAnalyze, postAsMemberOf, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUseMethods inherited from class org.checkerframework.framework.type.AnnotatedTypeFactory
adaptGetClassReturnTypeToReceiver, addAliasedDeclAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, applyCaptureConversion, applyCaptureConversion, applyUnboxing, areSameByClass, binaryTreeArgTypes, binaryTreeArgTypes, checkInvalidOptionsInferSignatures, compoundAssignmentTreeArgTypes, constructorFromUse, constructorFromUseWithoutTypeArgInference, containsCapturedTypes, containsSameByClass, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierHierarchy, createQualifierUpperBounds, createTypeArgumentInference, createTypeHierarchy, 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, getDummyAssignedTo, getElementUtils, getEnclosingClassOrMethod, getEnclosingElementForArtificialTree, getEnclosingSubType, getEnclosingType, getEnumConstructorQualifiers, getExpressionAndOffset, getFieldInvariantAnnotationTree, getFieldInvariantDeclarationAnnotations, getFieldInvariants, getFnInterfaceFromTree, getFunctionTypeFromTree, getFunctionTypeFromTree, getImplicitReceiverType, getIterableElementType, getIterableElementType, getMethodReturnType, getNarrowedAnnotations, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getQualifierParameterHierarchies, getQualifierParameterHierarchies, getQualifierUpperBounds, getReceiverType, getRecordedLambdaParameterType, getResultingTypeOfConstructorMemberReference, getSelfType, getSideEffectsOnlyExpressionMap, getSideEffectsOnlyExpressions, getStringType, getSupportedTypeQualifierNames, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeDeclarationBounds, getTypeHierarchy, getTypeOfExtendsImplements, getTypeVarSubstitutor, getUnboxedType, getVisitorTreePath, getWholeProgramInference, getWidenedAnnotations, getWidenedType, getWidenedType, hasDoesNotUnrefineReceiver, hasExplicitNoQualifierParameterInHierarchy, hasExplicitQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, initializeAtm, initializeReflectionResolution, isAliasedTypeAnnotation, isDeclAnnotationWrittenOn, isDeterministic, isFromByteCode, isFromStubFile, isImmutable, isParsingAnnotationFiles, isSideEffectFree, isSupportedQualifier, isSupportedQualifier, isSupportedQualifier, isTop, isWithinConstructor, logGat, makeConditionConsistentWithOtherMethod, mergeAnnotationFileAnnosIntoType, methodFromUse, methodFromUse, methodFromUse, methodFromUseWithoutTypeArgInference, methodFromUseWithoutTypeArgInference, negateConstant, order, parseAnnotationFiles, postProcessClassTree, recordLambdaParameterType, replaceAnnotations, replaceAnnotations, setEnclosingElementForArtificialTree, setVisitorTreePath, shouldWarnIfStubRedundantWithBytecode, toAnnotatedType, toString, type, wpiAdjustForUpdateField, wpiAdjustForUpdateNonField, wpiPrepareMethodForWriting, wpiPrepareMethodForWriting, wpiShouldInferFromNullAssignments, wpiShouldInferTypesForReceivers
-
Constructor Details
-
IteratorAnnotatedTypeFactory
Creates an IteratorAnnotatedTypeFactory.- Parameters:
checker- the associated type-checker
-
-
Method Details
-
topAnnotation
Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns the top qualifier of this checker's hierarchy, such as@MaybeGrowable.- Specified by:
topAnnotationin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- the top qualifier of this checker's hierarchy
-
positiveCapability
Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns the positive capability qualifier, such as@Growable.- Specified by:
positiveCapabilityin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- the positive capability qualifier
-
negativeCapability
Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns the negative capability qualifier, such as@Ungrowable. Only call this method ifModifiabilityBaseAnnotatedTypeFactory.hasNegativeCapability()returns true.- Specified by:
negativeCapabilityin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- the negative capability qualifier
-
hasNegativeCapability
protected boolean hasNegativeCapability()Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns true if this checker's hierarchy contains a negative qualifier, such as@Ungrowable. The Iterator hierarchy does not.- Overrides:
hasNegativeCapabilityin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- true if this checker's hierarchy contains a negative qualifier
-
polyCapability
Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns the polymorphic capability qualifier, such as@PolyGrowable.- Specified by:
polyCapabilityin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- the polymorphic capability qualifier
-
expandsModifiabilityAliases
protected boolean expandsModifiabilityAliases()Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns true if this checker's hierarchy is one of the capabilities that the whole-modifiability aliases (@Modifiable,@Unmodifiable,@MaybeModifiable,@UnmodifiableParam, and@PolyModifiable) expand into. The Iterator hierarchy is not: it states what a collection's iterator preserves rather than whether a mutating method throwsUnsupportedOperationException.- Overrides:
expandsModifiabilityAliasesin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- true if the whole-modifiability aliases expand into this checker's hierarchy
-
typesWithCapability
Description copied from class:ModifiabilityBaseAnnotatedTypeFactoryReturns erased types whose every subtype has this checker's capability, unlessModifiabilityBaseAnnotatedTypeFactory.typeLacksCapability(javax.lang.model.type.TypeMirror)holds of the subtype. For example, the Replace Checker's result includesList.A type variable or wildcard may be instantiated by any subtype of its upper bound, including a subtype that also implements an unrelated interface. For example, a type variable whose upper bound is
AbstractCollectionorSerializablemay be instantiated byHashSet, which cannot be replaced into. So an alias written on a type variable claims this checker's capability only if the upper bound is a subtype of one of these types.- Specified by:
typesWithCapabilityin classModifiabilityBaseAnnotatedTypeFactory- Returns:
- erased types whose subtypes have this checker's capability
-
createSupportedTypeQualifiers
Description 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 3 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( // These annotations are in the Called Methods Checker, not the Resource Leak Checker. CalledMethods.class, CalledMethodsBottom.class, CalledMethodsPredicate.class); } - Support only annotations that are explicitly listed. This is common when a single
directory holds qualifiers for multiple qualifier hierarchies. 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 classAnnotatedTypeFactory- Returns:
- the type qualifiers supported this processor, or an empty set if none
- Only support annotations located in a checker's qual directory:
-