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>

public class AnnotationEqualityVisitor extends DoubleJavaParserVisitor
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 Details

    • AnnotationEqualityVisitor

      public AnnotationEqualityVisitor()
      Constructs an AnnotationEqualityVisitor.
  • 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

      public @Nullable com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?> 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

      public @Nullable com.github.javaparser.ast.nodeTypes.NodeWithAnnotations<?> 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 class DoubleJavaParserVisitor
      Type Parameters:
      T - the Node type of node1 and node2
      Parameters:
      node1 - first node in pair
      node2 - second node in pair