public class PropagationTreeAnnotator extends TreeAnnotator
PropagationTreeAnnotator adds qualifiers to types where the resulting type is a function
of an input type, e.g. the result of a binary operation is a LUB of the type of expressions in
the binary operation.
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.
TreeAnnotatoratypeFactory| Constructor and Description |
|---|
PropagationTreeAnnotator(AnnotatedTypeFactory atypeFactory)
Creates a
PropagationTreeAnnotator for the given atypeFactory. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Void |
visitBinary(com.sun.source.tree.BinaryTree node,
AnnotatedTypeMirror type)
When overriding this method, getAnnotatedType on the left and right operands should only be
called when absolutely necessary.
|
java.lang.Void |
visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node,
AnnotatedTypeMirror type) |
java.lang.Void |
visitNewArray(com.sun.source.tree.NewArrayTree tree,
AnnotatedTypeMirror type) |
java.lang.Void |
visitTypeCast(com.sun.source.tree.TypeCastTree node,
AnnotatedTypeMirror type) |
java.lang.Void |
visitUnary(com.sun.source.tree.UnaryTree node,
AnnotatedTypeMirror type) |
visitMethoddefaultAction, visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitConditionalExpression, visitContinue, 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, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeParameter, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcardpublic PropagationTreeAnnotator(AnnotatedTypeFactory atypeFactory)
PropagationTreeAnnotator for the given atypeFactory.public java.lang.Void visitNewArray(com.sun.source.tree.NewArrayTree tree,
AnnotatedTypeMirror type)
visitNewArray in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>visitNewArray in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>public java.lang.Void visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node,
AnnotatedTypeMirror type)
visitCompoundAssignment in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>visitCompoundAssignment in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>public java.lang.Void visitBinary(com.sun.source.tree.BinaryTree node,
AnnotatedTypeMirror type)
TreeAnnotatorIf a checker's performance is still too slow, the types of binary trees could be computed
in a subclass of CFTransfer. When computing the
types in a transfer, look up the value in the store rather than the AnnotatedTypeFactory.
Then this method should annotate binary trees with top so that the type applied in the
transfer is always a subtype of the type the AnnotatedTypeFactory computes.
visitBinary in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>visitBinary in class TreeAnnotatorpublic java.lang.Void visitUnary(com.sun.source.tree.UnaryTree node,
AnnotatedTypeMirror type)
visitUnary in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>visitUnary in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>public java.lang.Void visitTypeCast(com.sun.source.tree.TypeCastTree node,
AnnotatedTypeMirror type)
visitTypeCast in interface com.sun.source.tree.TreeVisitor<java.lang.Void,AnnotatedTypeMirror>visitTypeCast in class com.sun.source.util.SimpleTreeVisitor<java.lang.Void,AnnotatedTypeMirror>