public class InterningAnnotatedTypeFactory extends BaseAnnotatedTypeFactory
AnnotatedTypeFactory
that accounts for the properties of the Interned type system.
This type factory will add the Interned
annotation to a type if the input:
BaseAnnotatedTypeFactory
and inherits its functionality, including:
flow-sensitive qualifier inference, qualifier polymorphism (of PolyInterned
), implicit
annotations via ImplicitFor
on Interned
(to handle cases 1, 2, 4), and
user-specified defaults via DefaultQualifier
. Case 5 is handled by the stub library.GenericAnnotatedTypeFactory.ScanState
AnnotatedTypeFactory.InheritedFromClassAnnotator
analyses, cfgVisualizer, defaults, dependentTypesHelper, FLOW_BY_DEFAULT, flowResult, initializationStaticStore, initializationStore, methodInvocationStores, poly, regularExitStores, returnStatementStores, scannedClasses, treeAnnotator, typeAnnotator
checker, elements, fromTreeCache, loader, processingEnv, qualHierarchy, reflectionResolver, root, shouldCache, trees, typeArgumentInference, typeFormatter, typeHierarchy, types, typeVarSubstitutor, uid, visitorState
Constructor and Description |
---|
InterningAnnotatedTypeFactory(BaseTypeChecker checker)
Creates a new
InterningAnnotatedTypeFactory that operates on a particular AST. |
Modifier and Type | Method and Description |
---|---|
void |
addComputedTypeAnnotations(Element element,
AnnotatedTypeMirror type)
Adds implicit annotations to a type obtained from a
Element . |
void |
addComputedTypeAnnotations(Tree tree,
AnnotatedTypeMirror type,
boolean useFlow)
Like {#addComputedTypeAnnotations(Tree, AnnotatedTypeMirror)}.
|
protected TreeAnnotator |
createTreeAnnotator()
Returns a
TreeAnnotator that adds annotations to a type based on the contents of a
tree. |
protected TypeAnnotator |
createTypeAnnotator()
Returns a
ImplicitsTypeAnnotator
that adds annotations to a type based on the content of the type itself. |
AnnotatedTypeMirror.AnnotatedPrimitiveType |
getUnboxedType(AnnotatedTypeMirror.AnnotatedDeclaredType type)
Unbox type and replace any interning type annotations with @Interned since all all primitives
can safely use ==.
|
createFlowAnalysis
addCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addTypeNameImplicit, addUncheckedCodeDefaults, addUncheckedStandardDefaults, analyze, analyze, applyInferredAnnotations, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, createCFGVisualizer, createDependentTypesHelper, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, fromNewClass, getAnnotatedTypeLhs, getAnnotatedTypeLhsNoTypeVarDefault, getAnnotationFromJavaExpressionString, getCFGVisualizer, getDependentTypesHelper, getEmptyStore, getFinalLocalValues, getInferredValueFor, getMethodReturnType, getMethodReturnType, getNodeForTree, getReceiverFromJavaExpressionString, getRegularExitStore, getResultingTypeOfConstructorMemberReference, getReturnStatementStores, getShouldDefaultTypeVarLocals, getSortedQualifierNames, getStoreAfter, getStoreBefore, getStoreBefore, getSupportedMonotonicTypeQualifiers, getTypeFactoryOfSubchecker, handleCFGViz, methodFromUse, performFlowAnalysis, postDirectSuperTypes, postInit, preProcessClassTree, setRoot, typeVariablesFromUse
adaptGetClassReturnTypeToReceiver, addAliasedAnnotation, addAliasedDeclAnnotation, addInheritedAnnotation, aliasedAnnotation, annotateInheritedFromClass, annotateInheritedFromClass, checkInvalidOptionsInferSignatures, createAnnotatedTypeFormatter, createAnnotationFormatter, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchy, createQualifierHierarchyFactory, createSupportedTypeQualifiers, createTypeArgumentInference, createTypeHierarchy, createTypeVariableSubstitutor, declarationFromElement, fromElement, fromElement, fromElement, getAnnotatedNullType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedType, getAnnotatedTypeFromTypeTree, getAnnotationFormatter, getAnnotationMirror, getAnnotationWithMetaAnnotation, getBoxedType, getBundledTypeQualifiersWithoutPolyAll, getBundledTypeQualifiersWithPolyAll, getContext, getCurrentClassTree, getCurrentClassType, getCurrentMethodReceiver, getDeclAnnotation, getDeclAnnotationNoAliases, getDeclAnnotations, getDeclAnnotationWithMetaAnnotation, getElementUtils, getEnclosingMethod, getEnclosingType, getFnInterfaceFromTree, getFnInterfaceFromTree, getImplicitReceiverType, getNarrowedPrimitive, getPath, getProcessingEnv, getQualifierHierarchy, getReceiverType, getSelfType, getStringType, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeHierarchy, getTypeVarSubstitutor, getUninferredWildcardType, getVisitorState, getWholeProgramInference, initilizeReflectionResolution, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isWithinConstructor, methodFromUse, parseStubFiles, postAsMemberOf, postProcessClassTree, postTypeVarSubstitution, setPathHack, toAnnotatedType, toString, type, widenToUpperBound
public InterningAnnotatedTypeFactory(BaseTypeChecker checker)
InterningAnnotatedTypeFactory
that operates on a particular AST.checker
- the checker to useprotected TreeAnnotator createTreeAnnotator()
GenericAnnotatedTypeFactory
TreeAnnotator
that adds annotations to a type based on the contents of a
tree.
Subclasses may override this method to specify a more appropriate TreeAnnotator
.
The default tree annotator is a ListTreeAnnotator
of the following:
PropagationTreeAnnotator
: Propagates annotations from subtrees.
ImplicitsTreeAnnotator
: Adds annotations based on ImplicitFor
meta-annotations
createTreeAnnotator
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
protected TypeAnnotator createTypeAnnotator()
GenericAnnotatedTypeFactory
ImplicitsTypeAnnotator
that adds annotations to a type based on the content of the type itself.
Subclass may override this method. The default type annotator is a ListTypeAnnotator
of the following:
IrrelevantTypeAnnotator
: Adds top to types not listed in the RelevantJavaTypes
annotation on the checker
PropagationTypeAnnotator
: Propagates annotation onto wildcards
ImplicitsTypeAnnotator
: Adds annotations based on ImplicitFor
meta-annotations
createTypeAnnotator
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
public void addComputedTypeAnnotations(Tree tree, AnnotatedTypeMirror type, boolean useFlow)
GenericAnnotatedTypeFactory
addComputedTypeAnnotations
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
public void addComputedTypeAnnotations(Element element, AnnotatedTypeMirror type)
AnnotatedTypeFactory
Element
. By default, this method
does nothing. Subclasses should use this method to implement implicit annotations specific to
their type systems.addComputedTypeAnnotations
in class GenericAnnotatedTypeFactory<CFValue,CFStore,CFTransfer,CFAnalysis>
element
- an elementtype
- the type obtained from elt
public AnnotatedTypeMirror.AnnotatedPrimitiveType getUnboxedType(AnnotatedTypeMirror.AnnotatedDeclaredType type)
getUnboxedType
in class AnnotatedTypeFactory
type
- the declared type