public abstract class InitializationAnnotatedTypeFactory<Value extends org.checkerframework.framework.flow.CFAbstractValue<Value>,Store extends InitializationStore<Value,Store>,Transfer extends InitializationTransfer<Value,Transfer,Store>,Flow extends org.checkerframework.framework.flow.CFAbstractAnalysis<Value,Store,Transfer>>
extends org.checkerframework.framework.type.GenericAnnotatedTypeFactory<Value,Store,Transfer,Flow>
NullnessChecker. Also supports rawness as a type-system for tracking initialization, though FBC
is preferred.| Modifier and Type | Class and Description |
|---|---|
protected class |
InitializationAnnotatedTypeFactory.CommitmentTreeAnnotator |
protected class |
InitializationAnnotatedTypeFactory.CommitmentTypeAnnotator |
protected class |
InitializationAnnotatedTypeFactory.InitializationQualifierHierarchy
The
QualifierHierarchy for the initialization type system. |
| Modifier and Type | Field and Description |
|---|---|
protected AnnotationMirror |
COMMITTED
Initialized or NonRaw. |
protected AnnotationMirror |
FBCBOTTOM
|
protected AnnotationMirror |
FREE
UnderInitialization or null. |
protected Set<Class<? extends Annotation>> |
initAnnos |
protected AnnotationMirror |
NOT_ONLY_COMMITTED
NotOnlyInitialized or null. |
protected AnnotationMirror |
UNCLASSIFIED
|
protected boolean |
useFbc
Should the initialization type system be FBC? If not, the rawness type system is used for
initialization.
|
analysis, cfgVisualizer, defaults, dependentTypesHelper, emptyStore, flowByDefault, flowResult, flowResultAnalysisCaches, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, transfer, treeAnnotator, typeAnnotatorchecker, elements, fromExpressionTreeCache, fromMemberTreeCache, fromTypeTreeCache, ignoreUninferredTypeArguments, loader, processingEnv, qualHierarchy, reflectionResolver, root, shouldCache, trees, typeArgumentInference, typeFormatter, typeHierarchy, types, typeVarSubstitutor, uid, visitorState| Constructor and Description |
|---|
InitializationAnnotatedTypeFactory(org.checkerframework.common.basetype.BaseTypeChecker checker,
boolean useFbc) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areAllFieldsCommittedOnly(ClassTree classTree)
Are all fields committed-only?
|
AnnotationMirror |
createFreeAnnotation(Class<?> typeFrame)
Creates a
UnderInitialization annotation with the given type frame. |
AnnotationMirror |
createFreeAnnotation(TypeMirror typeFrame)
Creates a
UnderInitialization annotation with the given type as its type frame
argument. |
protected org.checkerframework.framework.util.MultiGraphQualifierHierarchy.MultiGraphFactory |
createQualifierHierarchyFactory() |
protected org.checkerframework.framework.type.treeannotator.TreeAnnotator |
createTreeAnnotator() |
protected org.checkerframework.framework.type.typeannotator.TypeAnnotator |
createTypeAnnotator() |
AnnotationMirror |
createUnclassifiedAnnotation(Class<?> typeFrame)
Creates a
UnknownInitialization or Raw annotation with a given type frame. |
AnnotationMirror |
createUnclassifiedAnnotation(TypeMirror typeFrame)
Creates an
UnknownInitialization or Raw annotation with a given type frame. |
org.checkerframework.framework.type.AnnotatedTypeMirror |
getAnnotatedTypeLhs(Tree lhsTree) |
abstract AnnotationMirror |
getFieldInvariantAnnotation()
Returns the annotation that makes up the invariant of this commitment type system, such as
@NonNull. |
protected AnnotationMirror |
getFreeOrRawAnnotationOfSuperType(TypeMirror type)
Returns a
UnderInitialization annotation (or UnknownInitialization if rawness
is used) that has the supertype of type as type frame. |
Set<Class<? extends Annotation>> |
getInitializationAnnotations() |
List<VariableTree> |
getInitializedInvariantFields(Store store,
TreePath path)
Returns the (non-static) fields that have the invariant annotation and are initialized in a
given store.
|
Set<Class<? extends Annotation>> |
getInvalidConstructorReturnTypeAnnotations() |
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType |
getSelfType(Tree tree) |
TypeMirror |
getTypeFrameFromAnnotation(AnnotationMirror annotation)
Returns the type frame of a given annotation.
|
List<VariableTree> |
getUninitializedInvariantFields(Store store,
TreePath path,
boolean isStatic,
List<? extends AnnotationMirror> receiverAnnotations)
Returns the (non-static) fields that have the invariant annotation and are not yet
initialized in a given store.
|
protected abstract boolean |
hasFieldInvariantAnnotation(org.checkerframework.framework.type.AnnotatedTypeMirror type)
Returns whether or not
type has the invariant annotation. |
protected boolean |
hasFieldInvariantAnnotation(VariableTree field)
Returns whether or not
field has the invariant annotation. |
boolean |
isCommitted(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
Does
anno have the annotation Initialized? If useFbc is false, then
NonRaw is used in the comparison. |
boolean |
isCommitted(AnnotationMirror anno)
|
boolean |
isFbcBottom(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
Does
anno have the bottom annotation? |
boolean |
isFbcBottom(AnnotationMirror anno)
Is
anno the bottom annotation? |
boolean |
isFree(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
Does
anno have the annotation UnderInitialization (with any type frame)?
Always returns false if useFbc is false. |
boolean |
isFree(AnnotationMirror anno)
Is
anno the UnderInitialization annotation (with any type frame)? Always
returns false if useFbc is false. |
protected boolean |
isInitializationAnnotation(AnnotationMirror anno)
Is the annotation
anno an initialization qualifier? |
boolean |
isInitializedForFrame(org.checkerframework.framework.type.AnnotatedTypeMirror type,
TypeMirror frame) |
boolean |
isUnclassified(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
Does
anno have the annotation UnknownInitialization (with any type frame)? If
useFbc is false, then Raw is used in the comparison. |
boolean |
isUnclassified(AnnotationMirror anno)
Is
anno the UnknownInitialization annotation (with any type frame)? If useFbc is false, then Raw is used in the comparison. |
void |
postAsMemberOf(org.checkerframework.framework.type.AnnotatedTypeMirror type,
org.checkerframework.framework.type.AnnotatedTypeMirror owner,
Element element) |
protected void |
setSelfTypeInInitializationCode(Tree tree,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType selfType,
TreePath path) |
addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addDefaultAnnotations, addTypeNameImplicit, addUncheckedCodeDefaults, addUncheckedStandardDefaults, analyze, applyInferredAnnotations, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, createAndInitQualifierDefaults, createCFGVisualizer, createDependentTypesHelper, createFlowAnalysis, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, fromNewClass, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpressionString, getAnnotationFromReceiver, getAnnotationMirrorFromJavaExpressionString, getCFGVisualizer, getDependentTypesHelper, getEmptyStore, getFinalLocalValues, getFirstNodeOfKindForTree, getInferredValueFor, getMethodReturnType, getMethodReturnType, getNodesForTree, getReceiverFromJavaExpressionString, getRegularExitStore, getResultingTypeOfConstructorMemberReference, getReturnStatementStores, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreAfter, getStoreAfter, getStoreBefore, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, handleCFGViz, methodFromUse, performFlowAnalysis, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUseadaptGetClassReturnTypeToReceiver, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedAnnotation, addAliasedDeclAnnotation, addAnnotationFromFieldInvariant, addInheritedAnnotation, aliasedAnnotation, annotateInheritedFromClass, annotateInheritedFromClass, checkInvalidOptionsInferSignatures, createAnnotatedTypeFormatter, createAnnotationClassLoader, createAnnotationFormatter, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchy, createSupportedTypeQualifiers, createTypeArgumentInference, createTypeHierarchy, createTypeVariableSubstitutor, declarationFromElement, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFormatter, getAnnotatedTypeFromTypeTree, getAnnotationFormatter, getAnnotationMirror, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiersWithoutPolyAll, getBundledTypeQualifiersWithPolyAll, getCacheSize, getContext, getCurrentClassTree, getCurrentClassType, getCurrentMethodReceiver, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getElementUtils, getEnclosingMethod, getEnclosingType, getFieldInvariantAnnotationTree, getFieldInvariantDeclarationAnnotations, getFieldInvariants, getFnInterfaceFromTree, getFnInterfaceFromTree, getImplicitReceiverType, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getReceiverType, getStringType, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeHierarchy, getTypeVarSubstitutor, getUnboxedType, getUninferredWildcardType, getVisitorState, getWholeProgramInference, initializeReflectionResolution, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isWithinConstructor, methodFromUse, parseStubFiles, postProcessClassTree, postTypeVarSubstitution, setPathHack, toAnnotatedType, toString, type, widenToUpperBoundprotected final AnnotationMirror UNCLASSIFIED
protected final AnnotationMirror COMMITTED
Initialized or NonRaw.protected final AnnotationMirror FREE
UnderInitialization or null.protected final AnnotationMirror NOT_ONLY_COMMITTED
NotOnlyInitialized or null.protected final AnnotationMirror FBCBOTTOM
protected final boolean useFbc
protected final Set<Class<? extends Annotation>> initAnnos
public InitializationAnnotatedTypeFactory(org.checkerframework.common.basetype.BaseTypeChecker checker,
boolean useFbc)
public Set<Class<? extends Annotation>> getInitializationAnnotations()
protected boolean isInitializationAnnotation(AnnotationMirror anno)
anno an initialization qualifier?anno - the annotation to checkpublic Set<Class<? extends Annotation>> getInvalidConstructorReturnTypeAnnotations()
public abstract AnnotationMirror getFieldInvariantAnnotation()
@NonNull.protected final boolean hasFieldInvariantAnnotation(VariableTree field)
field has the invariant annotation.
This method is a convenience method for hasFieldInvariantAnnotation(AnnotatedTypeMirror).
If the field is a type variable, this method returns true if any possible
instantiation of the type parameter could have the invariant annotation. See hasFieldInvariantAnnotation(VariableTree) for an example.
field - field that might have invariant annotationprotected abstract boolean hasFieldInvariantAnnotation(org.checkerframework.framework.type.AnnotatedTypeMirror type)
type has the invariant annotation.
If the type is a type variable, this method returns true if any possible
instantiation of the type parameter could have the invariant annotation. See hasFieldInvariantAnnotation(VariableTree) for an example.
type - of field that might have invariant annotationpublic AnnotationMirror createFreeAnnotation(TypeMirror typeFrame)
UnderInitialization annotation with the given type as its type frame
argument.typeFrame - the type down to which some value has been initializedUnderInitialization annotation with the given argumentpublic AnnotationMirror createFreeAnnotation(Class<?> typeFrame)
UnderInitialization annotation with the given type frame.typeFrame - the type down to which some value has been initializedUnderInitialization annotation with the given argumentpublic AnnotationMirror createUnclassifiedAnnotation(Class<?> typeFrame)
UnknownInitialization or Raw annotation with a given type frame.typeFrame - the type down to which some value has been initializedUnknownInitialization or Raw annotation with the given argumentpublic AnnotationMirror createUnclassifiedAnnotation(TypeMirror typeFrame)
UnknownInitialization or Raw annotation with a given type frame.typeFrame - the type down to which some value has been initializedUnknownInitialization or Raw annotation with the given argumentpublic TypeMirror getTypeFrameFromAnnotation(AnnotationMirror annotation)
annotation - a UnderInitialization or UnknownInitialization annotationpublic boolean isFree(AnnotationMirror anno)
anno the UnderInitialization annotation (with any type frame)? Always
returns false if useFbc is false.anno - the annotation to checkanno is UnderInitializationpublic boolean isUnclassified(AnnotationMirror anno)
anno the UnknownInitialization annotation (with any type frame)? If useFbc is false, then Raw is used in the comparison.anno - the annotation to checkanno is UnknownInitialization or Rawpublic boolean isFbcBottom(AnnotationMirror anno)
anno the bottom annotation?public boolean isCommitted(AnnotationMirror anno)
anno - the annotation to checkanno is Initialized or NonRawpublic boolean isFree(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
anno have the annotation UnderInitialization (with any type frame)?
Always returns false if useFbc is false.anno - the annotation to checkanno has UnderInitializationpublic boolean isUnclassified(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
anno have the annotation UnknownInitialization (with any type frame)? If
useFbc is false, then Raw is used in the comparison.anno - the annotation to checkanno has UnknownInitialization or Rawpublic boolean isFbcBottom(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
anno have the bottom annotation?public boolean isCommitted(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
anno have the annotation Initialized? If useFbc is false, then
NonRaw is used in the comparison.anno - the annotation to checkanno has Initialized or NonRawprotected org.checkerframework.framework.util.MultiGraphQualifierHierarchy.MultiGraphFactory createQualifierHierarchyFactory()
createQualifierHierarchyFactory in class org.checkerframework.framework.type.AnnotatedTypeFactoryprotected boolean areAllFieldsCommittedOnly(ClassTree classTree)
public void postAsMemberOf(org.checkerframework.framework.type.AnnotatedTypeMirror type,
org.checkerframework.framework.type.AnnotatedTypeMirror owner,
Element element)
In most cases, subclasses want to call this method first because it may clear all annotations and use the hierarchy's root annotations.
postAsMemberOf in class org.checkerframework.framework.type.AnnotatedTypeFactorypublic org.checkerframework.framework.type.AnnotatedTypeMirror getAnnotatedTypeLhs(Tree lhsTree)
getAnnotatedTypeLhs in class org.checkerframework.framework.type.GenericAnnotatedTypeFactory<Value extends org.checkerframework.framework.flow.CFAbstractValue<Value>,Store extends InitializationStore<Value,Store>,Transfer extends InitializationTransfer<Value,Transfer,Store>,Flow extends org.checkerframework.framework.flow.CFAbstractAnalysis<Value,Store,Transfer>>public org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType getSelfType(Tree tree)
getSelfType in class org.checkerframework.framework.type.AnnotatedTypeFactoryprotected void setSelfTypeInInitializationCode(Tree tree, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType selfType, TreePath path)
protected AnnotationMirror getFreeOrRawAnnotationOfSuperType(TypeMirror type)
UnderInitialization annotation (or UnknownInitialization if rawness
is used) that has the supertype of type as type frame.public List<VariableTree> getUninitializedInvariantFields(Store store, TreePath path, boolean isStatic, List<? extends AnnotationMirror> receiverAnnotations)
public List<VariableTree> getInitializedInvariantFields(Store store, TreePath path)
public boolean isInitializedForFrame(org.checkerframework.framework.type.AnnotatedTypeMirror type,
TypeMirror frame)
protected org.checkerframework.framework.type.typeannotator.TypeAnnotator createTypeAnnotator()
createTypeAnnotator in class org.checkerframework.framework.type.GenericAnnotatedTypeFactory<Value extends org.checkerframework.framework.flow.CFAbstractValue<Value>,Store extends InitializationStore<Value,Store>,Transfer extends InitializationTransfer<Value,Transfer,Store>,Flow extends org.checkerframework.framework.flow.CFAbstractAnalysis<Value,Store,Transfer>>protected org.checkerframework.framework.type.treeannotator.TreeAnnotator createTreeAnnotator()
createTreeAnnotator in class org.checkerframework.framework.type.GenericAnnotatedTypeFactory<Value extends org.checkerframework.framework.flow.CFAbstractValue<Value>,Store extends InitializationStore<Value,Store>,Transfer extends InitializationTransfer<Value,Transfer,Store>,Flow extends org.checkerframework.framework.flow.CFAbstractAnalysis<Value,Store,Transfer>>