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
Lombok doesn't use array equality for array types with annotations, when generating the equals method.
The following defines a non null array.
@Value
public class TestClass {
Integer @NonNull [] array;
}
The following test fails.
public class TestClassTest {
@Test public void equals1() {
TestClass a = new TestClass(new Integer[]{null});
TestClass b = new TestClass(new Integer[]{null});
Assert.assertTrue(Arrays.equals(a.getArray(), b.getArray())); // Succeeds
Assert.assertEquals(a, b); // Fails
}
}
If I remove the annotation, the test succeeds.
Alternatively, if I declare the variable as @NonNull Integer [] I get the behavior I was expecting with the above notation, which is a non null array, instead of an array of non null integers.
The text was updated successfully, but these errors were encountered:
Lombok doesn't use array equality for array types with annotations, when generating the equals method.
The following defines a non null array.
The following test fails.
If I remove the annotation, the test succeeds.
Alternatively, if I declare the variable as
@NonNull Integer []
I get the behavior I was expecting with the above notation, which is a non null array, instead of an array of non null integers.The text was updated successfully, but these errors were encountered: