Class AnnotationEqualityVisitor
java.lang.Object
com.github.javaparser.ast.visitor.VoidVisitorAdapter<com.github.javaparser.ast.Node>
org.checkerframework.framework.ajava.DoubleJavaParserVisitor
org.checkerframework.framework.ajava.AnnotationEqualityVisitor
- All Implemented Interfaces:
com.github.javaparser.ast.visitor.VoidVisitor<com.github.javaparser.ast.Node>
Given two ASTs representing the same Java file that may differ in annotations, tests if they have
the same annotations.
To use this class, have the first AST node accept the visitor and pass the second AST node as
the second argument. Then, check getAnnotationsMatch()
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T extends com.github.javaparser.ast.Node>
voiddefaultAction
(T node1, T node2) Default action performed on all pairs of nodes from matching ASTs.boolean
Returns whether a visited pair of nodes differed in annotations.@Nullable com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>
If a visited pair of nodes has had mismatched annotations, returns the node from the first AST where annotations differed, or null otherwise.@Nullable com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?>
If a visited pair of nodes has had mismatched annotations, returns the node from the second AST where annotations differed, or null otherwise.Methods inherited from class org.checkerframework.framework.ajava.DoubleJavaParserVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
Methods inherited from class com.github.javaparser.ast.visitor.VoidVisitorAdapter
visit, visit, visit, visit
-
Constructor Details
-
AnnotationEqualityVisitor
public AnnotationEqualityVisitor()Constructs anAnnotationEqualityVisitor
.
-
-
Method Details
-
getAnnotationsMatch
public boolean getAnnotationsMatch()Returns whether a visited pair of nodes differed in annotations.- Returns:
- true if some visited pair of nodes differed in annotations
-
getMismatchedNode1
If a visited pair of nodes has had mismatched annotations, returns the node from the first AST where annotations differed, or null otherwise.- Returns:
- the node from the first AST with differing annotations or null
-
getMismatchedNode2
If a visited pair of nodes has had mismatched annotations, returns the node from the second AST where annotations differed, or null otherwise.- Returns:
- the node from the second AST with differing annotations or null
-
defaultAction
public <T extends com.github.javaparser.ast.Node> void defaultAction(T node1, T node2) Description copied from class:DoubleJavaParserVisitor
Default action performed on all pairs of nodes from matching ASTs.- Specified by:
defaultAction
in classDoubleJavaParserVisitor
- Type Parameters:
T
- the Node type ofnode1
andnode2
- Parameters:
node1
- first node in pairnode2
- second node in pair
-