You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The EqualsVerifier expects prefab values for recursive datastructures even when the recursive fields are ignored.
What is the code that triggers this problem?
class A {
A a;
String b;
@Override public boolean equals(Object obj) { ... }
@Override public int hashCode() { ... }
}
EqualsVerifier.forClass(A.class)
.withIgnoredFields("a")
.verify();
The actual implementations of equals(Object) and hashCode() are irrelevant.
What error message or stack trace does EqualsVerifier give?
java.lang.AssertionError: Recursive datastructure.
Add prefab values for one of the following types: A.
For more information, go to: http://www.jqno.nl/equalsverifier/errormessages
at nl.jqno.equalsverifier.EqualsVerifier.handleError(EqualsVerifier.java:381)
at nl.jqno.equalsverifier.EqualsVerifier.verify(EqualsVerifier.java:367)
What did you expect?
The EqualsVerifier should not require prefab values for A.
Which version of EqualsVerifier are you using?
2.1.5
Please provide any additional information below.
This also happens if the recursive field is a Collection.
The text was updated successfully, but these errors were encountered:
Unfortunately, it's still necessary to add prefab values for ignored fields if they're recursive. EqualsVerifier will ignore them for checking the equals contract, but it can't know if the fields aren't called in equals or hashCode anyway. For example, you class could theoretically contain a cache that is not part of the contract, but that's consulted in the equals method anyway.
What steps will reproduce the problem?
The EqualsVerifier expects prefab values for recursive datastructures even when the recursive fields are ignored.
What is the code that triggers this problem?
The actual implementations of
equals(Object)
andhashCode()
are irrelevant.What error message or stack trace does EqualsVerifier give?
What did you expect?
The EqualsVerifier should not require prefab values for
A
.Which version of EqualsVerifier are you using?
2.1.5
Please provide any additional information below.
This also happens if the recursive field is a Collection.
The text was updated successfully, but these errors were encountered: