public class GuiEffectTypeFactory
extends org.checkerframework.common.basetype.BaseAnnotatedTypeFactory
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
debugSpew |
protected Set<TypeElement> |
uiAnonClasses
Keeps track of all anonymous inner classes with inferred UIEffect.
|
protected Set<LambdaExpressionTree> |
uiLambdas
Keeps track of all lambda expressions with inferred UIEffect.
|
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 |
|---|
GuiEffectTypeFactory(org.checkerframework.common.basetype.BaseTypeChecker checker,
boolean spew) |
| Modifier and Type | Method and Description |
|---|---|
void |
constrainAnonymousClassToUI(TypeElement classElt)
Force the given anonymous inner class to be an @UI instantiation of its base class.
|
void |
constrainLambdaToUI(LambdaExpressionTree lambdaExpressionTree)
Force the given lambda expression to have UIEffect.
|
protected org.checkerframework.framework.type.treeannotator.TreeAnnotator |
createTreeAnnotator() |
Effect.EffectRange |
findInheritedEffectRange(TypeElement declaringType,
ExecutableElement overridingMethod) |
Effect.EffectRange |
findInheritedEffectRange(TypeElement declaringType,
ExecutableElement overridingMethod,
boolean issueConflictWarning,
Tree errorNode) |
ExecutableElement |
findJavaOverride(ExecutableElement overrider,
TypeMirror parentType) |
org.checkerframework.framework.type.AnnotatedTypeMirror |
getAnnotatedType(Tree tree) |
Effect |
getComputedEffectAtCallsite(MethodInvocationTree node,
org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType callerReceiver,
ExecutableElement methodElt)
Get the effect of a method call at its callsite, acknowledging polymorphic instantiation
using type use annotations.
|
Effect |
getDeclaredEffect(ExecutableElement methodElt)
Calling context annotations.
|
Effect |
getInferedEffectForLambdaExpression(LambdaExpressionTree lambdaTree)
Get the inferred effect of a lambda expression based on the type annotations of its
functional interface and the effects of the calls in its body.
|
boolean |
isDirectlyMarkedUIThroughInference(Tree tree)
Test if this tree corresponds to a lambda expression or new class marked as UI affecting by
either
constrainLambdaToUI} or constrainAnonymousClassToUI(TypeElement). |
boolean |
isPolymorphicType(TypeElement cls) |
boolean |
isUIType(TypeElement cls) |
createFlowAnalysisaddCheckedCodeDefaults, addCheckedStandardDefaults, addComputedTypeAnnotations, addComputedTypeAnnotations, addComputedTypeAnnotations, addDefaultAnnotations, addTypeNameImplicit, addUncheckedCodeDefaults, addUncheckedStandardDefaults, analyze, applyInferredAnnotations, checkAndPerformFlowAnalysis, checkForDefaultQualifierInHierarchy, constructorFromUse, createAndInitQualifierDefaults, createCFGVisualizer, createDependentTypesHelper, createFlowTransferFunction, createQualifierDefaults, createQualifierPolymorphism, createTypeAnnotator, fromNewClass, getAnnotatedTypeLhs, 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, createQualifierHierarchyFactory, createSupportedTypeQualifiers, createTypeArgumentInference, createTypeHierarchy, createTypeVariableSubstitutor, declarationFromElement, fromElement, fromElement, fromElement, getAnnotatedNullType, 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, getSelfType, getStringType, getSupportedTypeQualifiers, getTreeUtils, getTypeArgumentInference, getTypeHierarchy, getTypeVarSubstitutor, getUnboxedType, getUninferredWildcardType, getVisitorState, getWholeProgramInference, initializeReflectionResolution, isAnyEnclosingThisDeref, isFromByteCode, isFromStubFile, isMostEnclosingThisDeref, isSupportedQualifier, isWithinConstructor, methodFromUse, parseStubFiles, postAsMemberOf, postProcessClassTree, postTypeVarSubstitution, setPathHack, toAnnotatedType, toString, type, widenToUpperBoundprotected final boolean debugSpew
protected final Set<LambdaExpressionTree> uiLambdas
constrainLambdaToUI adds lambda
expressions to this set, and is called from GuiEffectVisitor whenever a lambda expression
calls a @UIEffect method. Afterwards getInferedEffectForLambdaExpression uses this set and the type annotations of the functional
interface of the lambda to figure out if it can affect the UI or not.
protected final Set<TypeElement> uiAnonClasses
constrainAnonymousClassToUI adds
anonymous inner classes to this set, and is called from GuiEffectVisitor whenever an
anonymous inner class calls a @UIEffect method. Afterwards isUIType and getAnnotatedType will treat this inner class as
if it had been annotated with @UI.
public GuiEffectTypeFactory(org.checkerframework.common.basetype.BaseTypeChecker checker,
boolean spew)
public ExecutableElement findJavaOverride(ExecutableElement overrider, TypeMirror parentType)
public boolean isPolymorphicType(TypeElement cls)
public boolean isUIType(TypeElement cls)
public Effect getDeclaredEffect(ExecutableElement methodElt)
To make anon-inner-classes work, I need to climb the inheritance DAG, until I:
public Effect getComputedEffectAtCallsite(MethodInvocationTree node, org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType callerReceiver, ExecutableElement methodElt)
node - The method invocation as an AST node.callerReceiver - The type of the receiver object if available. Used to resolve direct
calls like "super()"methodElt - The element of the callee method.public Effect getInferedEffectForLambdaExpression(LambdaExpressionTree lambdaTree)
This relies on GuiEffectVisitor to perform the actual inference step and mark lambdas
with @PolyUIEffect functional interfaces as being explicitly UI-affecting using the constrainLambdaToUI method.
lambdaTree - A lambda expression's AST node.public boolean isDirectlyMarkedUIThroughInference(Tree tree)
constrainLambdaToUI} or constrainAnonymousClassToUI(TypeElement). Only explicit markings due to inference are
considered here, for the properly computed type of the expression, use getAnnotatedType(Tree) instead.tree - The tree to check.public org.checkerframework.framework.type.AnnotatedTypeMirror getAnnotatedType(Tree tree)
getAnnotatedType in class org.checkerframework.framework.type.AnnotatedTypeFactorypublic Effect.EffectRange findInheritedEffectRange(TypeElement declaringType, ExecutableElement overridingMethod)
public Effect.EffectRange findInheritedEffectRange(TypeElement declaringType, ExecutableElement overridingMethod, boolean issueConflictWarning, Tree errorNode)
protected org.checkerframework.framework.type.treeannotator.TreeAnnotator createTreeAnnotator()
createTreeAnnotator in class org.checkerframework.framework.type.GenericAnnotatedTypeFactory<org.checkerframework.framework.flow.CFValue,org.checkerframework.framework.flow.CFStore,org.checkerframework.framework.flow.CFTransfer,org.checkerframework.framework.flow.CFAnalysis>public void constrainLambdaToUI(LambdaExpressionTree lambdaExpressionTree)
Used by GuiEffectVisitor to mark as UIEffect all lambdas that perform UIEffect calls inside their bodies.
lambdaExpressionTree - A lambda expression's AST node.public void constrainAnonymousClassToUI(TypeElement classElt)
Used by GuiEffectVisitor to mark as @UI all anonymous inner classes which: inherit from a PolyUIType annotated superclass, override a PolyUIEffect method from said superclass, and perform UIEffect calls inside the body of this method.
classElt - The TypeElement corresponding to the anonymous inner class to mark as an @UI
instantiation of an UI-polymorphic superclass.