Class SignednessAnnotatedTypeFactory
java.lang.Object
org.checkerframework.framework.type.AnnotatedTypeFactory
org.checkerframework.framework.type.GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
org.checkerframework.common.basetype.BaseAnnotatedTypeFactory
org.checkerframework.checker.signedness.SignednessAnnotatedTypeFactory
- All Implemented Interfaces:
AnnotationProvider
The type factory for the Signedness Checker.
- See the Checker Framework Manual:
- Signedness Checker
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
GenericAnnotatedTypeFactory.ScanStateNested classes/interfaces inherited from class org.checkerframework.framework.type.AnnotatedTypeFactory
AnnotatedTypeFactory.CapturedTypeVarSubstitutor, AnnotatedTypeFactory.ParameterizedExecutableType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AnnotationMirrorThe @PolySigned annotation.protected final AnnotationMirrorThe @Signed annotation.protected final AnnotationMirrorThe @SignedPositive annotation.protected final AnnotationMirrorThe @SignednessBottom annotation.protected final AnnotationMirrorThe @SignednessGlb annotation.protected final AnnotationMirrorThe @Unsigned annotation.Fields inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
analysis, arraysAreRelevant, cfgVisualizer, contractsUtils, defaults, dependentTypesHelper, emptyStore, exceptionalExitStores, flowByDefault, flowResult, flowResultAnalysisCaches, formalParameterPattern, hasOrIsSubchecker, initializationStaticStore, initializationStore, poly, regularExitStores, relevantJavaTypes, returnStatementStores, scannedClasses, shouldClearSubcheckerSharedCFGs, sideEffectsUnrefineAliases, subcheckerSharedCFG, transfer, treeAnnotator, typeAnnotatorFields inherited from class org.checkerframework.framework.type.AnnotatedTypeFactory
ajavaTypes, annotatedForValueElement, 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, shouldCache, stubTypes, trees, typeArgumentInference, typeFormatter, typeHierarchy, typeInformationPresenter, types, typeVarSubstitutor, uid, viewpointAdapter -
Constructor Summary
ConstructorsConstructorDescriptionCreate a SignednessAnnotatedTypeFactory. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadaptGetClassReturnTypeToReceiver(AnnotatedTypeMirror.AnnotatedExecutableType getClassType, AnnotatedTypeMirror receiverType, ExpressionTree tree) Java special-cases the return type ofgetClass().protected voidaddAnnotationsFromDefaultForType(@Nullable Element element, AnnotatedTypeMirror type) Adds default qualifiers based on the underlying type oftypetotype.protected voidaddComputedTypeAnnotations(Tree tree, AnnotatedTypeMirror type) Changes annotations on a type obtained from aTree.Returns the annotations that should appear on the given irrelevant Java type.protected QualifierPolymorphismCreates theQualifierPolymorphisminstance which supports the QualifierPolymorphism mechanism.protected TreeAnnotatorReturns aTreeAnnotatorthat adds annotations to a type based on the contents of a tree.getNarrowedAnnotations(AnnotationMirrorSet annos, TypeKind typeKind, TypeKind narrowedTypeKind) Returns annotations applicable to typenarrowedTypeKind, that are copied or adapted fromannos.getWidenedAnnotations(AnnotationMirrorSet annos, TypeKind typeKind, TypeKind widenedTypeKind) Returns annotations applicable to typewidenedTypeKind, that are copied or adapted fromannos.booleanReturns true iftype's underlying type might be integral: it is a number, char, or a supertype of them.Methods inherited from class org.checkerframework.common.basetype.BaseAnnotatedTypeFactory
createFlowAnalysisMethods inherited from class org.checkerframework.framework.type.GenericAnnotatedTypeFactory
addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotationsWithoutFlow, addDefaultAnnotations, addSharedCFGForTree, addUncheckedStandardDefaults, analyze, applyInferredAnnotations, applyQualifierParameterDefaults, applyQualifierParameterDefaults, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, constructorFromUsePreSubstitution, createAndInitQualifierDefaults, createCFGVisualizer, createContractsFromMethod, createDefaultForTypeAnnotator, createDefaultForUseTypeAnnotator, createDependentTypesHelper, createFlowTransferFunction, createQualifierDefaults, createRequiresOrEnsuresQualifier, createTypeAnnotator, getAnnotatedTypeBefore, getAnnotatedTypeLhs, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpression, getAnnotationFromJavaExpressionString, getAnnotationMirrorFromJavaExpressionString, getAnnotationsFromJavaExpression, getCFGVisualizer, getContractExpressions, getContractsFromMethod, getDefaultAnnotations, getDefaultForTypeAnnotator, getDefaultValueAnnotatedType, getDependentTypesHelper, getEmptyStore, getEnsuresQualifierIfResult, getExceptionalExitStore, getExplicitNewClassAnnos, getExplicitNewClassClassTypeArgs, getExpressionAndOffsetFromJavaExpressionString, getFinalLocalValues, getFirstNodeOfKindForTree, getInferredValueFor, getMethodReturnType, getNodesForTree, getQualifierPolymorphism, getRegularExitStore, getReturnStatementStores, getSharedCFGForTree, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreAfter, getStoreAfter, getStoreBefore, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, getTypeFactoryOfSubcheckerOrNull, getUseFlow, handleCFGViz, irrelevantExtraMessage, isComputingAnnotatedTypeMirrorOfLhs, isIgnoredExceptionType, isNotFullyInitializedReceiver, isRelevant, isRelevant, isRelevantImpl, methodFromUse, methodFromUsePreSubstitution, parseJavaExpressionString, performFlowAnalysis, postAnalyze, postAsMemberOf, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUseMethods inherited from class org.checkerframework.framework.type.AnnotatedTypeFactory
addAliasedDeclAnnotation, addAliasedDeclAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAliasedTypeAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, applyCaptureConversion, applyCaptureConversion, applyUnboxing, areSameByClass, binaryTreeArgTypes, binaryTreeArgTypes, canonicalAnnotation, compoundAssignmentTreeArgTypes, constructorFromUse, constructorFromUseWithoutTypeArgInference, containsCapturedTypes, containsSameByClass, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierHierarchy, createQualifierUpperBounds, createSupportedTypeQualifiers, createTypeArgumentInference, createTypeHierarchy, createTypeInformationPresenter, createTypeVariableSubstitutor, createViewpointAdapter, declarationFromElement, doesAnnotatedForApplyToThisChecker, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFormatter, getAnnotatedTypeFromTypeTree, getAnnotationByClass, getAnnotationFormatter, getAnnotationMirror, getAnnotationOrTypeDeclarationBound, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiers, getCacheSize, getChecker, getCheckerNames, getContractExpressions, getContractListValues, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getDefaultTypeDeclarationBounds, getDummyAssignedTo, getElementUtils, getEnclosingClassOrMethod, getEnclosingSubType, getEnclosingType, getEnumConstructorQualifiers, getExpressionAndOffset, getFieldInvariantAnnotationTree, getFieldInvariantDeclarationAnnotations, getFieldInvariants, getFnInterfaceFromTree, getFunctionTypeFromTree, getFunctionTypeFromTree, getImplicitReceiverType, getIterableElementType, getIterableElementType, getMethodReturnType, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getQualifierParameterHierarchies, getQualifierParameterHierarchies, getQualifierUpperBounds, getReceiverType, getResultingTypeOfConstructorMemberReference, getRoot, getSelfType, getStringType, getSupportedTypeQualifierNames, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeDeclarationBounds, getTypeHierarchy, getTypeOfExtendsImplements, getTypeVarSubstitutor, getUnboxedType, getVisitorTreePath, getWidenedType, getWidenedType, hasExplicitNoQualifierParameterInHierarchy, hasExplicitQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, hasQualifierParameterInHierarchy, initializeAtm, initializeReflectionResolution, isDeterministic, isFromByteCode, isFromStubFile, isImmutable, isSideEffectFree, isSupportedQualifier, isSupportedQualifier, isSupportedQualifier, isWithinConstructor, mergeAnnotationFileAnnosIntoType, methodFromUse, methodFromUse, methodFromUse, methodFromUseWithoutTypeArgInference, methodFromUseWithoutTypeArgInference, negateConstant, order, parseAnnotationFiles, postProcessClassTree, replaceAnnotations, replaceAnnotations, setPathForArtificialTree, setVisitorTreePath, shouldWarnIfStubRedundantWithBytecode, toAnnotatedType, toString, type
-
Field Details
-
SIGNED
The @Signed annotation. -
UNSIGNED
The @Unsigned annotation. -
SIGNEDNESS_GLB
The @SignednessGlb annotation. Do not use @SignedPositive; use this instead. -
SIGNED_POSITIVE
The @SignedPositive annotation. -
SIGNEDNESS_BOTTOM
The @SignednessBottom annotation. -
POLY_SIGNED
The @PolySigned annotation.
-
-
Constructor Details
-
SignednessAnnotatedTypeFactory
Create a SignednessAnnotatedTypeFactory.- Parameters:
checker- the type-checker associated with this type factory
-
-
Method Details
-
addComputedTypeAnnotations
Description copied from class:GenericAnnotatedTypeFactoryChanges annotations on a type obtained from aTree. By default, this method does nothing. GenericAnnotatedTypeFactory uses this method to implement defaulting and inference (flow-sensitive type refinement). Its subclasses usually override it only to customize default annotations.Subclasses that override this method should also override
AnnotatedTypeFactory.addComputedTypeAnnotations(Element, AnnotatedTypeMirror).This method adds defaults and flow-sensitive type refinements.
- Overrides:
addComputedTypeAnnotationsin classGenericAnnotatedTypeFactory<CFValue,CFStore, CFTransfer, CFAnalysis> - Parameters:
tree- an AST nodetype- the type obtained fromtree- See Also:
-
getWidenedAnnotations
public 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 classAnnotatedTypeFactory- Parameters:
annos- annotations to widen, from a primitive or boxed primitivetypeKind- primitive type to widenwidenedTypeKind- target for the returned annotations; a primitive type that is wider thantypeKind(in the sense of JLS 5.1.2)- Returns:
- result of converting
annosfromtypeKindtowidenedTypeKind
-
getNarrowedAnnotations
public AnnotationMirrorSet getNarrowedAnnotations(AnnotationMirrorSet annos, TypeKind typeKind, TypeKind narrowedTypeKind) Description copied from class:AnnotatedTypeFactoryReturns annotations applicable to typenarrowedTypeKind, that are copied or adapted fromannos.- Overrides:
getNarrowedAnnotationsin classAnnotatedTypeFactory- Parameters:
annos- annotations to narrow, from a primitive or boxed primitivetypeKind- primitive type to narrownarrowedTypeKind- target for the returned annotations; a primitive type that is narrower thantypeKind(in the sense of JLS 5.1.3).- Returns:
- result of converting
annosfromtypeKindtonarrowedTypeKind
-
createTreeAnnotator
Description 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 subtreesLiteralTreeAnnotator: Adds annotations based onQualifierForLiteralsmeta-annotationsDependentTypesTreeAnnotator: 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 classGenericAnnotatedTypeFactory<CFValue,CFStore, CFTransfer, CFAnalysis> - Returns:
- a tree annotator
-
annotationsForIrrelevantJavaType
Description copied from class:GenericAnnotatedTypeFactoryReturns the annotations that should appear on the given irrelevant Java type. If the type is relevant, this method's behavior is undefined.- Overrides:
annotationsForIrrelevantJavaTypein classGenericAnnotatedTypeFactory<CFValue,CFStore, CFTransfer, CFAnalysis> - Parameters:
tm- an irrelevant Java type- Returns:
- the annotations that should appear on the given irrelevant Java type
-
maybeIntegral
Returns true iftype's underlying type might be integral: it is a number, char, or a supertype of them.- Parameters:
type- a type- Returns:
- true if
type's underlying type might be integral
-
adaptGetClassReturnTypeToReceiver
protected void adaptGetClassReturnTypeToReceiver(AnnotatedTypeMirror.AnnotatedExecutableType getClassType, AnnotatedTypeMirror receiverType, ExpressionTree tree) Description copied from class:AnnotatedTypeFactoryJava special-cases the return type ofgetClass(). Though the method has a return type ofClass<?>, the compiler special cases this return-type and changes the bound of the type argument to the erasure of the receiver type. For example:x.getClass()has the typeClass< ? extends erasure_of_x >someInteger.getClass()has the typeClass< ? extends Integer >
- Overrides:
adaptGetClassReturnTypeToReceiverin classAnnotatedTypeFactory- Parameters:
getClassType- this must be a type representing a call to Object.getClass otherwise a runtime exception will be thrown. It is modified by side effect.receiverType- the receiver type of the method invocation (not the declared receiver type)tree- getClass method invocation tree
-
addAnnotationsFromDefaultForType
protected void addAnnotationsFromDefaultForType(@Nullable Element element, AnnotatedTypeMirror type) Description copied from class:GenericAnnotatedTypeFactoryAdds default qualifiers based on the underlying type oftypetotype. Ifelementis a local variable, or if the type already has an annotation from the relevant type hierarchy, then the defaults are not added.(This uses both the
DefaultQualifierForUseTypeAnnotatorandDefaultForTypeAnnotator.)- Overrides:
addAnnotationsFromDefaultForTypein classGenericAnnotatedTypeFactory<CFValue,CFStore, CFTransfer, CFAnalysis> - Parameters:
element- possibly null element whose type istypetype- the type to which defaults are added
-
createQualifierPolymorphism
Description copied from class:GenericAnnotatedTypeFactoryCreates theQualifierPolymorphisminstance which supports the QualifierPolymorphism mechanism.- Overrides:
createQualifierPolymorphismin classGenericAnnotatedTypeFactory<CFValue,CFStore, CFTransfer, CFAnalysis> - Returns:
- the QualifierPolymorphism instance to use
-