|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<java.lang.Void,java.lang.Void>
checkers.flow.MainFlow
public class MainFlow
A modified version of Flow.
Should report errors during the flow analysis, as no information is recorded for later retrieval.
Also, subtyping isn't checked in any way.
Detailed changes:
- removed the QualifierHierarchy annoRelations field and all its usages
- removed the AnnotationMirror test(Tree tree) method
- removed the Map<Location, AnnotationMirror> flowResults field and all its usages
- removed the void recordBits(TreePath path) method and all its usages
Flow class.| Field Summary | |
|---|---|
protected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> |
annos
Tracks the annotated state of each variable during flow. |
protected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> |
annosWhenFalse
Tracks the annotated state of each variable in a false branch. |
protected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> |
annosWhenTrue
Tracks the annotated state of each variable in a true branch. |
protected java.util.Set<javax.lang.model.element.AnnotationMirror> |
annotations
The annotations (qualifiers) to infer. |
protected checkers.types.AnnotatedTypes |
atypes
Utility class for operations on annotated types. |
protected java.util.Deque<checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror>> |
catchBits
Tracks annotations in potential exception-throwing statements in catch blocks. |
protected checkers.source.SourceChecker |
checker
The checker to which this instance belongs. |
protected javax.lang.model.util.Elements |
elements
Utilities for Elements. |
protected javax.annotation.processing.ProcessingEnvironment |
env
The processing environment to use. |
protected checkers.types.AnnotatedTypeFactory |
factory
Utility class for determining annotated types. |
protected com.sun.source.tree.CompilationUnitTree |
root
The file that's being analyzed. |
protected com.sun.source.util.SourcePositions |
source
Utility class for getting source positions. |
protected java.util.Deque<checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror>> |
tryBits
Tracks annotations in potential exception-throwing statements in try blocks. |
protected java.util.List<javax.lang.model.element.VariableElement> |
vars
Maps variables to a bit index. |
| Constructor Summary | |
|---|---|
MainFlow(checkers.source.SourceChecker checker,
com.sun.source.tree.CompilationUnitTree root,
java.util.Set<javax.lang.model.element.AnnotationMirror> annotations,
checkers.types.AnnotatedTypeFactory factory)
Creates a new analysis. |
|
| Method Summary | |
|---|---|
java.lang.Void |
scan(com.sun.source.tree.Tree tree,
java.lang.Void p)
|
protected void |
scanCond(com.sun.source.tree.Tree tree)
Called whenever a conditional expression is scanned. |
protected void |
scanDef(com.sun.source.tree.Tree tree)
Called whenever a definition is scanned. |
protected void |
scanExpr(com.sun.source.tree.ExpressionTree tree)
Called whenever an expression is scanned. |
protected void |
scanStat(com.sun.source.tree.StatementTree tree)
Called whenever a statement is scanned. |
protected void |
scanStats(java.util.List<? extends com.sun.source.tree.StatementTree> trees)
Called whenever a block of statements is scanned. |
protected void |
updateExceptionBits()
|
protected void |
updateExceptionBits(checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> exceptionBits)
Updates the current try and catch bits on an exception-throwing statement. |
java.lang.Void |
visitAnnotation(com.sun.source.tree.AnnotationTree tree,
java.lang.Void p)
|
java.lang.Void |
visitAssert(com.sun.source.tree.AssertTree node,
java.lang.Void p)
|
java.lang.Void |
visitAssignment(com.sun.source.tree.AssignmentTree node,
java.lang.Void p)
|
java.lang.Void |
visitBlock(com.sun.source.tree.BlockTree node,
java.lang.Void p)
|
java.lang.Void |
visitBreak(com.sun.source.tree.BreakTree node,
java.lang.Void p)
|
java.lang.Void |
visitClass(com.sun.source.tree.ClassTree node,
java.lang.Void p)
|
java.lang.Void |
visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node,
java.lang.Void p)
|
java.lang.Void |
visitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree node,
java.lang.Void p)
|
java.lang.Void |
visitContinue(com.sun.source.tree.ContinueTree node,
java.lang.Void p)
|
java.lang.Void |
visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree node,
java.lang.Void p)
|
java.lang.Void |
visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree node,
java.lang.Void p)
|
java.lang.Void |
visitForLoop(com.sun.source.tree.ForLoopTree node,
java.lang.Void p)
|
java.lang.Void |
visitIf(com.sun.source.tree.IfTree node,
java.lang.Void p)
|
java.lang.Void |
visitImport(com.sun.source.tree.ImportTree tree,
java.lang.Void p)
|
java.lang.Void |
visitMethod(com.sun.source.tree.MethodTree node,
java.lang.Void p)
|
java.lang.Void |
visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node,
java.lang.Void p)
|
java.lang.Void |
visitReturn(com.sun.source.tree.ReturnTree node,
java.lang.Void p)
|
java.lang.Void |
visitThrow(com.sun.source.tree.ThrowTree node,
java.lang.Void p)
|
java.lang.Void |
visitTry(com.sun.source.tree.TryTree node,
java.lang.Void p)
|
java.lang.Void |
visitVariable(com.sun.source.tree.VariableTree node,
java.lang.Void p)
|
java.lang.Void |
visitWhileLoop(com.sun.source.tree.WhileLoopTree node,
java.lang.Void p)
|
| Methods inherited from class com.sun.source.util.TreePathScanner |
|---|
getCurrentPath, scan |
| Methods inherited from class com.sun.source.util.TreeScanner |
|---|
reduce, scan, visitAnnotatedType, visitArrayAccess, visitArrayType, visitBinary, visitCase, visitCatch, visitCompilationUnit, visitEmptyStatement, visitErroneous, visitExpressionStatement, visitIdentifier, visitInstanceOf, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitNewArray, visitNewClass, visitOther, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitSwitch, visitSynchronized, visitTypeCast, visitTypeParameter, visitUnary, visitWildcard |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final checkers.source.SourceChecker checker
protected final javax.annotation.processing.ProcessingEnvironment env
protected final com.sun.source.tree.CompilationUnitTree root
protected final java.util.Set<javax.lang.model.element.AnnotationMirror> annotations
protected final com.sun.source.util.SourcePositions source
protected final checkers.types.AnnotatedTypeFactory factory
protected final checkers.types.AnnotatedTypes atypes
protected final java.util.List<javax.lang.model.element.VariableElement> vars
protected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> annos
vars. This field is set to
null immediately after splitting for a branch, and is set to some
combination (usually boolean "and") of annosWhenTrue and
annosWhenFalse after merging. Since it is used when visiting the
true and false branches, however, it may be non-null concurrently with
annosWhenTrue and annosWhenFalse.
protected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> annosWhenTrue
javac's Flow, saving/restoring via local variables
handles nested branches. Bit indices correspond exactly to indices in
vars. This field is copied from annos when splitting
for a branch and is set to null immediately after merging.
annosprotected checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> annosWhenFalse
javac's Flow, saving/restoring via local variables
handles nested branches. Bit indices correspond exactly to indices in
vars. This field is copied from annos when splitting
for a branch and is set to null immediately after merging.
annosprotected final java.util.Deque<checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror>> tryBits
protected final java.util.Deque<checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror>> catchBits
protected final javax.lang.model.util.Elements elements
Elements.
| Constructor Detail |
|---|
public MainFlow(checkers.source.SourceChecker checker,
com.sun.source.tree.CompilationUnitTree root,
java.util.Set<javax.lang.model.element.AnnotationMirror> annotations,
checkers.types.AnnotatedTypeFactory factory)
AnnotatedTypeFactory to obtain annotated types.
checker - the current checkerroot - the compilation unit that will be scannedannotations - the annotations to trackfactory - the factory class that will be used to get annotated
types, or null if the default factory should be used| Method Detail |
|---|
public java.lang.Void scan(com.sun.source.tree.Tree tree,
java.lang.Void p)
scan in class com.sun.source.util.TreePathScanner<java.lang.Void,java.lang.Void>protected void scanDef(com.sun.source.tree.Tree tree)
tree - the definition being scannedprotected void scanStat(com.sun.source.tree.StatementTree tree)
tree - the statement being scannedprotected void scanStats(java.util.List<? extends com.sun.source.tree.StatementTree> trees)
trees - the statements being scannedprotected void scanCond(com.sun.source.tree.Tree tree)
tree - the condition being scannedprotected void scanExpr(com.sun.source.tree.ExpressionTree tree)
tree - the expression being scanned
public java.lang.Void visitClass(com.sun.source.tree.ClassTree node,
java.lang.Void p)
visitClass in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitClass in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitImport(com.sun.source.tree.ImportTree tree,
java.lang.Void p)
visitImport in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitImport in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitAnnotation(com.sun.source.tree.AnnotationTree tree,
java.lang.Void p)
visitAnnotation in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitAnnotation in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitVariable(com.sun.source.tree.VariableTree node,
java.lang.Void p)
visitVariable in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitVariable in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitAssignment(com.sun.source.tree.AssignmentTree node,
java.lang.Void p)
visitAssignment in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitAssignment in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitCompoundAssignment(com.sun.source.tree.CompoundAssignmentTree node,
java.lang.Void p)
visitCompoundAssignment in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitCompoundAssignment in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitEnhancedForLoop(com.sun.source.tree.EnhancedForLoopTree node,
java.lang.Void p)
visitEnhancedForLoop in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitEnhancedForLoop in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitAssert(com.sun.source.tree.AssertTree node,
java.lang.Void p)
visitAssert in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitAssert in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitIf(com.sun.source.tree.IfTree node,
java.lang.Void p)
visitIf in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitIf in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitConditionalExpression(com.sun.source.tree.ConditionalExpressionTree node,
java.lang.Void p)
visitConditionalExpression in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitConditionalExpression in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitWhileLoop(com.sun.source.tree.WhileLoopTree node,
java.lang.Void p)
visitWhileLoop in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitWhileLoop in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitDoWhileLoop(com.sun.source.tree.DoWhileLoopTree node,
java.lang.Void p)
visitDoWhileLoop in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitDoWhileLoop in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitForLoop(com.sun.source.tree.ForLoopTree node,
java.lang.Void p)
visitForLoop in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitForLoop in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitBreak(com.sun.source.tree.BreakTree node,
java.lang.Void p)
visitBreak in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitBreak in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitContinue(com.sun.source.tree.ContinueTree node,
java.lang.Void p)
visitContinue in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitContinue in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitReturn(com.sun.source.tree.ReturnTree node,
java.lang.Void p)
visitReturn in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitReturn in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitThrow(com.sun.source.tree.ThrowTree node,
java.lang.Void p)
visitThrow in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitThrow in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitTry(com.sun.source.tree.TryTree node,
java.lang.Void p)
visitTry in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitTry in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>protected void updateExceptionBits(checkers.flow.GenKillBits<javax.lang.model.element.AnnotationMirror> exceptionBits)
exceptionBits - The annotations on the statement, in case an exception is thrown.protected void updateExceptionBits()
public java.lang.Void visitMethodInvocation(com.sun.source.tree.MethodInvocationTree node,
java.lang.Void p)
visitMethodInvocation in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitMethodInvocation in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitBlock(com.sun.source.tree.BlockTree node,
java.lang.Void p)
visitBlock in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitBlock in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
public java.lang.Void visitMethod(com.sun.source.tree.MethodTree node,
java.lang.Void p)
visitMethod in interface com.sun.source.tree.TreeVisitor<java.lang.Void,java.lang.Void>visitMethod in class com.sun.source.util.TreeScanner<java.lang.Void,java.lang.Void>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||