Package org.sonar.java.model
Class SyntacticEquivalence
java.lang.Object
org.sonar.java.model.SyntacticEquivalence
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList)
static boolean
areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList, BiPredicate<JavaTree,JavaTree> permissiveEquivalence)
static boolean
areEquivalent(Tree leftNode, Tree rightNode)
static boolean
areSemanticallyEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList)
Syntactic equivalence with additional semantic equivalence for methods calls.
-
Method Details
-
areEquivalent
- Returns:
- true, if nodes are syntactically equivalent
-
areEquivalent
- Returns:
- true, if nodes are syntactically equivalent
-
areEquivalent
public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList, BiPredicate<JavaTree,JavaTree> permissiveEquivalence)- Returns:
- true, if nodes are syntactically equivalent Use permissiveEquivalence to force the equivalence of two nodes
-
areSemanticallyEquivalent
public static boolean areSemanticallyEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList)Syntactic equivalence with additional semantic equivalence for methods calls. Two methods calls are equivalent only if they have the same signature; if the types of the arguments are the same.- Returns:
- true, if nodes are syntactically and semantically equivalent.
-