Some node equality changes
This commit is contained in:
@@ -430,17 +430,6 @@ public interface Node {
|
||||
@Override
|
||||
boolean equals(Object obj);
|
||||
|
||||
/**
|
||||
* Gets if this Node is equal to another node as defined by the given
|
||||
* {@link StandardNodeEquality} predicate.
|
||||
*
|
||||
* @param other the other node
|
||||
* @param equalityPredicate the predicate
|
||||
* @return true if this node is considered equal
|
||||
* @since 4.1
|
||||
*/
|
||||
boolean standardEquals(Node other, StandardNodeEquality equalityPredicate);
|
||||
|
||||
/**
|
||||
* Gets if this Node is equal to another node as defined by the given
|
||||
* {@link NodeEqualityPredicate}.
|
||||
@@ -450,9 +439,7 @@ public interface Node {
|
||||
* @return true if this node is considered equal
|
||||
* @since 4.1
|
||||
*/
|
||||
default boolean equals(Node other, NodeEqualityPredicate equalityPredicate) {
|
||||
return equalityPredicate.areEqual(this, other);
|
||||
}
|
||||
boolean equals(Node other, NodeEqualityPredicate equalityPredicate);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the
|
||||
|
||||
@@ -41,7 +41,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
public interface NodeEqualityPredicate {
|
||||
|
||||
/**
|
||||
* Returns if the two nodes are equal
|
||||
* Returns if the two nodes are equal.
|
||||
*
|
||||
* <p>This method should avoid making calls to {@link Node#equals(Node, NodeEqualityPredicate)}
|
||||
* with {@code this} as the second argument, directly or otherwise.</p>
|
||||
*
|
||||
* @param o1 the first node
|
||||
* @param o2 the second node
|
||||
|
||||
@@ -73,6 +73,6 @@ public enum StandardNodeEquality implements NodeEqualityPredicate {
|
||||
|
||||
@Override
|
||||
public boolean areEqual(@NonNull Node o1, @NonNull Node o2) {
|
||||
return o1.standardEquals(o2, this);
|
||||
return o1.equals(o2, this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user