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 javax.lang.model.element.AnnotationMirror |
COMMITTED
|
protected javax.lang.model.element.AnnotationMirror |
FBCBOTTOM
|
protected javax.lang.model.element.AnnotationMirror |
FREE
UnderInitialization or null |
protected java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> |
initAnnos |
protected javax.lang.model.element.AnnotationMirror |
NOT_ONLY_COMMITTED
NotOnlyInitialized or null |
protected javax.lang.model.element.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, FLOW_BY_DEFAULT, flowResult, flowResultAnalysisCaches, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, transfer, treeAnnotator, typeAnnotator
checker, 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?
|
javax.lang.model.element.AnnotationMirror |
createFreeAnnotation(java.lang.Class<?> typeFrame)
Returns a
UnderInitialization annotation with a given type frame. |
javax.lang.model.element.AnnotationMirror |
createFreeAnnotation(javax.lang.model.type.TypeMirror typeFrame)
Returns a
UnderInitialization annotation with a given type frame. |
protected org.checkerframework.framework.util.MultiGraphQualifierHierarchy.MultiGraphFactory |
createQualifierHierarchyFactory() |
protected org.checkerframework.framework.type.treeannotator.TreeAnnotator |
createTreeAnnotator() |
protected org.checkerframework.framework.type.typeannotator.TypeAnnotator |
createTypeAnnotator() |
javax.lang.model.element.AnnotationMirror |
createUnclassifiedAnnotation(java.lang.Class<?> typeFrame)
Returns a
UnknownInitialization or Raw annotation with a given type frame. |
javax.lang.model.element.AnnotationMirror |
createUnclassifiedAnnotation(javax.lang.model.type.TypeMirror typeFrame)
Returns a
UnknownInitialization annotation with a given type frame. |
org.checkerframework.framework.type.AnnotatedTypeMirror |
getAnnotatedTypeLhs(Tree lhsTree) |
abstract javax.lang.model.element.AnnotationMirror |
getFieldInvariantAnnotation()
Returns the annotation that makes up the invariant of this commitment type system, such as
@NonNull . |
protected javax.lang.model.element.AnnotationMirror |
getFreeOrRawAnnotationOfSuperType(javax.lang.model.type.TypeMirror type)
Returns a
UnderInitialization annotation (or UnknownInitialization if rawness
is used) that has the supertype of type as type frame. |
java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> |
getInitializationAnnotations() |
java.util.List<VariableTree> |
getInitializedInvariantFields(Store store,
TreePath path)
Returns the (non-static) fields that have the invariant annotation and are initialized in a
given store.
|
java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> |
getInvalidConstructorReturnTypeAnnotations() |
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType |
getSelfType(Tree tree) |
javax.lang.model.type.TypeMirror |
getTypeFrameFromAnnotation(javax.lang.model.element.AnnotationMirror annotation)
Returns the type frame of a given annotation.
|
java.util.List<VariableTree> |
getUninitializedInvariantFields(Store store,
TreePath path,
boolean isStatic,
java.util.List<? extends javax.lang.model.element.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(javax.lang.model.element.AnnotationMirror anno)
|
boolean |
isFbcBottom(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
Does
anno have the bottom annotation? |
boolean |
isFbcBottom(javax.lang.model.element.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(javax.lang.model.element.AnnotationMirror anno)
Is
anno the UnderInitialization annotation (with any type frame)? Always
returns false if useFbc is false. |
protected boolean |
isInitializationAnnotation(javax.lang.model.element.AnnotationMirror anno)
Is the annotation
anno an initialization qualifier? |
boolean |
isInitializedForFrame(org.checkerframework.framework.type.AnnotatedTypeMirror type,
javax.lang.model.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(javax.lang.model.element.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,
javax.lang.model.element.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, analyze, applyInferredAnnotations, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, createAndInitQualifierDefaults, createCFGVisualizer, createDependentTypesHelper, createFlowAnalysis, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, fromNewClass, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotatedTypeRhsUnaryAssign, getAnnotatedTypeVarargsArray, getAnnotationFromJavaExpressionString, getAnnotationFromReceiver, 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, typeVariablesFromUse
adaptGetClassReturnTypeToReceiver, 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, widenToUpperBound
protected final javax.lang.model.element.AnnotationMirror UNCLASSIFIED
protected final javax.lang.model.element.AnnotationMirror COMMITTED
protected final javax.lang.model.element.AnnotationMirror FREE
UnderInitialization
or nullprotected final javax.lang.model.element.AnnotationMirror NOT_ONLY_COMMITTED
NotOnlyInitialized
or nullprotected final javax.lang.model.element.AnnotationMirror FBCBOTTOM
protected final boolean useFbc
protected final java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> initAnnos
public InitializationAnnotatedTypeFactory(org.checkerframework.common.basetype.BaseTypeChecker checker, boolean useFbc)
public java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getInitializationAnnotations()
protected boolean isInitializationAnnotation(javax.lang.model.element.AnnotationMirror anno)
anno
an initialization qualifier?public java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getInvalidConstructorReturnTypeAnnotations()
public abstract javax.lang.model.element.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 javax.lang.model.element.AnnotationMirror createFreeAnnotation(javax.lang.model.type.TypeMirror typeFrame)
UnderInitialization
annotation with a given type frame.public javax.lang.model.element.AnnotationMirror createFreeAnnotation(java.lang.Class<?> typeFrame)
UnderInitialization
annotation with a given type frame.public javax.lang.model.element.AnnotationMirror createUnclassifiedAnnotation(java.lang.Class<?> typeFrame)
UnknownInitialization
or Raw
annotation with a given type frame.public javax.lang.model.element.AnnotationMirror createUnclassifiedAnnotation(javax.lang.model.type.TypeMirror typeFrame)
UnknownInitialization
annotation with a given type frame.public javax.lang.model.type.TypeMirror getTypeFrameFromAnnotation(javax.lang.model.element.AnnotationMirror annotation)
UnderInitialization
or UnknownInitialization
.public boolean isFree(javax.lang.model.element.AnnotationMirror anno)
anno
the UnderInitialization
annotation (with any type frame)? Always
returns false if useFbc
is false.public boolean isUnclassified(javax.lang.model.element.AnnotationMirror anno)
anno
the UnknownInitialization
annotation (with any type frame)? If useFbc
is false, then Raw
is used in the comparison.public boolean isFbcBottom(javax.lang.model.element.AnnotationMirror anno)
anno
the bottom annotation?public boolean isCommitted(javax.lang.model.element.AnnotationMirror anno)
public boolean isFree(org.checkerframework.framework.type.AnnotatedTypeMirror anno)
anno
have the annotation UnderInitialization
(with any type frame)?
Always returns false if useFbc
is false.public 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.public 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.protected org.checkerframework.framework.util.MultiGraphQualifierHierarchy.MultiGraphFactory createQualifierHierarchyFactory()
createQualifierHierarchyFactory
in class org.checkerframework.framework.type.AnnotatedTypeFactory
protected boolean areAllFieldsCommittedOnly(ClassTree classTree)
public void postAsMemberOf(org.checkerframework.framework.type.AnnotatedTypeMirror type, org.checkerframework.framework.type.AnnotatedTypeMirror owner, javax.lang.model.element.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.AnnotatedTypeFactory
public 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.AnnotatedTypeFactory
protected void setSelfTypeInInitializationCode(Tree tree, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType selfType, TreePath path)
protected javax.lang.model.element.AnnotationMirror getFreeOrRawAnnotationOfSuperType(javax.lang.model.type.TypeMirror type)
UnderInitialization
annotation (or UnknownInitialization
if rawness
is used) that has the supertype of type
as type frame.public java.util.List<VariableTree> getUninitializedInvariantFields(Store store, TreePath path, boolean isStatic, java.util.List<? extends javax.lang.model.element.AnnotationMirror> receiverAnnotations)
public java.util.List<VariableTree> getInitializedInvariantFields(Store store, TreePath path)
public boolean isInitializedForFrame(org.checkerframework.framework.type.AnnotatedTypeMirror type, javax.lang.model.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>>