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
EqualsVerifier succeeds for ClassB, but not for ClassA. Apparently,
Feature.FIELDS_ARE_NEVER_NULL only works for the class that is verified,
and not for its fields.
final class ClassA {
private final ClassB b;
public ClassA(ClassB b) {
if (b == null) {
throw new NullPointerException("b");
}
this.b = b;
}
@Override
public int hashCode() {
return b.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj instanceof ClassA) && ((ClassA) obj).b.equals(b);
}
}
final class ClassB {
private final Object o;
public ClassB(Object o) {
if (o == null) {
throw new NullPointerException("o");
}
this.o = o;
}
@Override
public int hashCode() {
return o.hashCode();
}
@Override
public boolean equals(Object obj) {
return (obj instanceof ClassB) && o.equals(((ClassB) obj).o);
}
}
Original issue reported on code.google.com by [email protected] on 24 Jan 2010 at 8:07
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 24 Jan 2010 at 8:07The text was updated successfully, but these errors were encountered: