Class PropagationTreeAnnotator
java.lang.Object
com.sun.source.util.SimpleTreeVisitor<Void,AnnotatedTypeMirror>
org.checkerframework.framework.type.treeannotator.TreeAnnotator
org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator
- All Implemented Interfaces:
TreeVisitor<Void,AnnotatedTypeMirror>
- Direct Known Subclasses:
NullnessAnnotatedTypeFactory.NullnessPropagationTreeAnnotator
PropagationTreeAnnotator adds qualifiers to types where the resulting type is a function
of an input type.
By default, it applies LUBs, e.g., the result of a binary operation is a LUB of the type of expressions in the binary operation, and likewise for compound operations. It also handles unary expressions, array creation, and casts.
PropagationTreeAnnotator is generally run first by ListTreeAnnotator since the
trees it handles are not usually targets of @DefaultFor.
PropagationTreeAnnotator does not traverse trees deeply by default.
- See Also:
-
Field Summary
Fields inherited from class org.checkerframework.framework.type.treeannotator.TreeAnnotator
atypeFactoryFields inherited from class com.sun.source.util.SimpleTreeVisitor
DEFAULT_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionPropagationTreeAnnotator(AnnotatedTypeFactory atypeFactory) Creates aPropagationTreeAnnotatorfor the givenatypeFactory. -
Method Summary
Modifier and TypeMethodDescriptionvisitBinary(BinaryTree tree, AnnotatedTypeMirror type) When overriding this method, getAnnotatedType on the left and right operands should only be called when absolutely necessary.visitNewArray(NewArrayTree arrayTree, AnnotatedTypeMirror arrayType) visitTypeCast(TypeCastTree tree, AnnotatedTypeMirror type) visitUnary(UnaryTree tree, AnnotatedTypeMirror type) Methods inherited from class org.checkerframework.framework.type.treeannotator.TreeAnnotator
log, visitMethodMethods inherited from class com.sun.source.util.SimpleTreeVisitor
defaultAction, visit, visit, visitAnnotatedType, visitAnnotation, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitConditionalExpression, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethodInvocation, visitModifiers, visitModule, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeParameter, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard, visitYield
-
Constructor Details
-
PropagationTreeAnnotator
Creates aPropagationTreeAnnotatorfor the givenatypeFactory.
-
-
Method Details
-
visitNewArray
- Specified by:
visitNewArrayin interfaceTreeVisitor<Void,AnnotatedTypeMirror> - Overrides:
visitNewArrayin classSimpleTreeVisitor<Void,AnnotatedTypeMirror>
-
visitCompoundAssignment
- Specified by:
visitCompoundAssignmentin interfaceTreeVisitor<Void,AnnotatedTypeMirror> - Overrides:
visitCompoundAssignmentin classSimpleTreeVisitor<Void,AnnotatedTypeMirror>
-
visitBinary
Description copied from class:TreeAnnotatorWhen overriding this method, getAnnotatedType on the left and right operands should only be called when absolutely necessary. Otherwise, the checker will be very slow on heavily nested binary trees. (For example, a + b + c + d + e + f + g + h.)One approach is to perform work in this method only if
type.hasPrimaryAnnotationInHierarchy(...)returns false.If a checker's performance is still too slow:
- Compute the types of binary trees in a subclass of
CFTransfer; look up the value in the store rather than the AnnotatedTypeFactory. - This method (
TreeAnnotator.visitBinary) should annotate binary trees with top so that the type applied in the transfer is always a subtype of the type the AnnotatedTypeFactory computes.
- Specified by:
visitBinaryin interfaceTreeVisitor<Void,AnnotatedTypeMirror> - Overrides:
visitBinaryin classTreeAnnotator
- Compute the types of binary trees in a subclass of
-
visitUnary
- Specified by:
visitUnaryin interfaceTreeVisitor<Void,AnnotatedTypeMirror> - Overrides:
visitUnaryin classSimpleTreeVisitor<Void,AnnotatedTypeMirror>
-
visitTypeCast
- Specified by:
visitTypeCastin interfaceTreeVisitor<Void,AnnotatedTypeMirror> - Overrides:
visitTypeCastin classSimpleTreeVisitor<Void,AnnotatedTypeMirror>
-