diff --git a/build.gradle b/build.gradle
index 01b6cfcd4c4..d0dce05f0fa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ plugins {
id 'com.github.bjornvester.xjc' version '1.8.2' apply false
id 'io.github.goooler.shadow' version '8.1.8' apply false
id 'me.champeau.jmh' version '0.7.2' apply false
- id "io.spring.nullability" version "0.0.1" apply false
+ id 'io.spring.nullability' version '0.0.4' apply false
}
ext {
diff --git a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
index 98fedfd795b..c32075563ea 100644
--- a/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/ObjectUtils.java
@@ -255,7 +255,7 @@ public abstract class ObjectUtils {
* @param obj the object to append
* @return the new array (of the same component type; never {@code null})
*/
- public static A[] addObjectToArray(A @Nullable [] array, @Nullable O obj) {
+ public static A[] addObjectToArray(A @Nullable [] array, O obj) {
return addObjectToArray(array, obj, (array != null ? array.length : 0));
}
@@ -268,17 +268,18 @@ public abstract class ObjectUtils {
* @return the new array (of the same component type; never {@code null})
* @since 6.0
*/
- public static @Nullable A[] addObjectToArray(A @Nullable [] array, @Nullable O obj, int position) {
+ public static A[] addObjectToArray(A @Nullable [] array, O obj, int position) {
Class> componentType = Object.class;
if (array != null) {
componentType = array.getClass().componentType();
}
+ // Defensive code for use cases not following the declared nullability
else if (obj != null) {
componentType = obj.getClass();
}
int newArrayLength = (array != null ? array.length + 1 : 1);
@SuppressWarnings("unchecked")
- @Nullable A[] newArray = (A[]) Array.newInstance(componentType, newArrayLength);
+ A[] newArray = (A[]) Array.newInstance(componentType, newArrayLength);
if (array != null) {
System.arraycopy(array, 0, newArray, 0, position);
System.arraycopy(array, position, newArray, position + 1, array.length - position);
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
index 734b217ab7c..096d397cd37 100644
--- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
+++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java
@@ -1413,7 +1413,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
* @return the RowMapper to use
* @see SingleColumnRowMapper
*/
- protected RowMapper<@Nullable T> getSingleColumnRowMapper(Class requiredType) {
+ protected RowMapper getSingleColumnRowMapper(Class requiredType) {
return new SingleColumnRowMapper<>(requiredType);
}