[Java][Spring] fix imports for nullable helpers (#10234)

This commit is contained in:
Oleh Kurpiak
2021-09-02 06:01:12 +03:00
committed by GitHub
parent 74f84b6f9b
commit c148539ce3
18 changed files with 38 additions and 68 deletions

View File

@@ -461,7 +461,7 @@ public class EnumTest {
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
@@ -473,9 +473,7 @@ public class EnumTest {
if (a == null) {
return 1;
}
return a.isPresent()
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
: 31;
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override

View File

@@ -90,7 +90,7 @@ public class HealthCheckResult {
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
@@ -102,9 +102,7 @@ public class HealthCheckResult {
if (a == null) {
return 1;
}
return a.isPresent()
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
: 31;
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override

View File

@@ -585,7 +585,7 @@ public class NullableClass extends HashMap<String, Object> {
}
private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && a.get().getClass().isArray() ? Arrays.equals((T[])a.get(), (T[])b.get()) : Objects.equals(a.get(), b.get()));
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
@@ -597,9 +597,7 @@ public class NullableClass extends HashMap<String, Object> {
if (a == null) {
return 1;
}
return a.isPresent()
? (a.get().getClass().isArray() ? Arrays.hashCode((T[])a.get()) : Objects.hashCode(a.get()))
: 31;
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override