A synthesizeAnnotation(A annotation, @Nullable Object annotatedElement) {
if (annotation == null) {
return null;
}
@@ -1548,8 +1548,7 @@ public abstract class AnnotationUtils {
* @see #synthesizeAnnotation(Annotation, AnnotatedElement)
* @see #synthesizeAnnotation(Map, Class, AnnotatedElement)
*/
- @Nullable
- static Annotation[] synthesizeAnnotationArray(@Nullable Annotation[] annotations, @Nullable Object annotatedElement) {
+ static Annotation[] synthesizeAnnotationArray(Annotation[] annotations, @Nullable Object annotatedElement) {
if (annotations == null) {
return null;
}
diff --git a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java
index 424b2be498..424ea518d0 100644
--- a/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java
+++ b/spring-core/src/main/java/org/springframework/core/env/PropertySourcesPropertyResolver.java
@@ -38,7 +38,7 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
* Create a new resolver against the given property sources.
* @param propertySources the set of {@link PropertySource} objects to use
*/
- public PropertySourcesPropertyResolver(PropertySources propertySources) {
+ public PropertySourcesPropertyResolver(@Nullable PropertySources propertySources) {
this.propertySources = propertySources;
}
diff --git a/spring-core/src/main/java/org/springframework/lang/NonNullApi.java b/spring-core/src/main/java/org/springframework/lang/NonNullApi.java
index ae95ebfa13..7c06b2dbde 100644
--- a/spring-core/src/main/java/org/springframework/lang/NonNullApi.java
+++ b/spring-core/src/main/java/org/springframework/lang/NonNullApi.java
@@ -18,6 +18,7 @@ import javax.annotation.meta.TypeQualifierDefault;
*
* @author Sebastien Deleuze
* @since 5.0
+ * @see NonNull
* @see javax.annotation.Nonnull
*/
@Documented
diff --git a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
index 976b997148..33d6b0c328 100644
--- a/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/ReflectionUtils.java
@@ -140,7 +140,8 @@ public abstract class ReflectionUtils {
* @param target the target object from which to get the field
* @return the field's current value
*/
- public static Object getField(Field field, Object target) {
+ @Nullable
+ public static Object getField(Field field, @Nullable Object target) {
try {
return field.get(target);
}
diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java
index 1cf25b3775..37e41dc8c9 100644
--- a/spring-core/src/main/java/org/springframework/util/StringUtils.java
+++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java
@@ -978,7 +978,7 @@ public abstract class StringUtils {
* @param array the original {@code String} array
* @return the resulting array (of the same size) with trimmed elements
*/
- public static String[] trimArrayElements(String[] array) {
+ public static String[] trimArrayElements(@Nullable String[] array) {
if (ObjectUtils.isEmpty(array)) {
return new String[0];
}
diff --git a/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java b/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java
index 92ac80c1b5..ef137630c4 100644
--- a/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java
+++ b/spring-web/src/main/java/org/springframework/web/context/WebApplicationContext.java
@@ -19,6 +19,7 @@ package org.springframework.web.context;
import javax.servlet.ServletContext;
import org.springframework.context.ApplicationContext;
+import org.springframework.lang.Nullable;
/**
* Interface to provide configuration for a web application. This is read-only while
@@ -100,6 +101,7 @@ public interface WebApplicationContext extends ApplicationContext {
* Return the standard Servlet API ServletContext for this application.
* Also available for a Portlet application, in addition to the PortletContext.
*/
+ @Nullable
ServletContext getServletContext();
}
diff --git a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java
index 3546efd130..f14a28945b 100644
--- a/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java
+++ b/spring-web/src/main/java/org/springframework/web/util/HtmlUtils.java
@@ -16,6 +16,7 @@
package org.springframework.web.util;
+import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -58,7 +59,7 @@ public abstract class HtmlUtils {
* @param input the (unescaped) input string
* @return the escaped string
*/
- public static String htmlEscape(String input) {
+ public static String htmlEscape(@Nullable String input) {
return htmlEscape(input, WebUtils.DEFAULT_CHARACTER_ENCODING);
}
@@ -78,7 +79,7 @@ public abstract class HtmlUtils {
* @return the escaped string
* @since 4.1.2
*/
- public static String htmlEscape(String input, String encoding) {
+ public static String htmlEscape(@Nullable String input, String encoding) {
Assert.notNull(encoding, "Encoding is required");
if (input == null) {
return null;
@@ -109,7 +110,7 @@ public abstract class HtmlUtils {
* @param input the (unescaped) input string
* @return the escaped string
*/
- public static String htmlEscapeDecimal(String input) {
+ public static String htmlEscapeDecimal(@Nullable String input) {
return htmlEscapeDecimal(input, WebUtils.DEFAULT_CHARACTER_ENCODING);
}
@@ -129,7 +130,7 @@ public abstract class HtmlUtils {
* @return the escaped string
* @since 4.1.2
*/
- public static String htmlEscapeDecimal(String input, String encoding) {
+ public static String htmlEscapeDecimal(@Nullable String input, String encoding) {
Assert.notNull(encoding, "Encoding is required");
if (input == null) {
return null;
@@ -161,7 +162,7 @@ public abstract class HtmlUtils {
* @param input the (unescaped) input string
* @return the escaped string
*/
- public static String htmlEscapeHex(String input) {
+ public static String htmlEscapeHex(@Nullable String input) {
return htmlEscapeHex(input, WebUtils.DEFAULT_CHARACTER_ENCODING);
}
@@ -181,7 +182,7 @@ public abstract class HtmlUtils {
* @return the escaped string
* @since 4.1.2
*/
- public static String htmlEscapeHex(String input, String encoding) {
+ public static String htmlEscapeHex(@Nullable String input, String encoding) {
Assert.notNull(encoding, "Encoding is required");
if (input == null) {
return null;
@@ -220,7 +221,7 @@ public abstract class HtmlUtils {
* @param input the (escaped) input string
* @return the unescaped string
*/
- public static String htmlUnescape(String input) {
+ public static String htmlUnescape(@Nullable String input) {
if (input == null) {
return null;
}
diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
index 3741b94a45..1b0e5d6188 100644
--- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
+++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
@@ -69,9 +69,9 @@ public final class RequestMappingInfo implements RequestCondition custom) {
+ public RequestMappingInfo(@Nullable String name, @Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
+ @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
+ @Nullable ProducesRequestCondition produces, @Nullable RequestCondition> custom) {
this.name = (StringUtils.hasText(name) ? name : null);
this.patternsCondition = (patterns != null ? patterns : new PatternsRequestCondition());
@@ -86,9 +86,9 @@ public final class RequestMappingInfo implements RequestCondition custom) {
+ public RequestMappingInfo(@Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
+ @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
+ @Nullable ProducesRequestCondition produces, @Nullable RequestCondition> custom) {
this(null, patterns, methods, params, headers, consumes, produces, custom);
}
@@ -96,7 +96,7 @@ public final class RequestMappingInfo implements RequestCondition customRequestCondition) {
+ public RequestMappingInfo(RequestMappingInfo info, @Nullable RequestCondition> customRequestCondition) {
this(info.name, info.patternsCondition, info.methodsCondition, info.paramsCondition, info.headersCondition,
info.consumesCondition, info.producesCondition, customRequestCondition);
}
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
index 45a6f740a2..8ac5f38e42 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
@@ -54,7 +54,7 @@ public class HandlerExecutionChain {
* Create a new HandlerExecutionChain.
* @param handler the handler object to execute
*/
- public HandlerExecutionChain(Object handler) {
+ public HandlerExecutionChain(@Nullable Object handler) {
this(handler, (HandlerInterceptor[]) null);
}
@@ -64,7 +64,7 @@ public class HandlerExecutionChain {
* @param interceptors the array of interceptors to apply
* (in the given order) before the handler itself executes
*/
- public HandlerExecutionChain(Object handler, HandlerInterceptor... interceptors) {
+ public HandlerExecutionChain(@Nullable Object handler, HandlerInterceptor... interceptors) {
if (handler instanceof HandlerExecutionChain) {
HandlerExecutionChain originalChain = (HandlerExecutionChain) handler;
this.handler = originalChain.getHandler();
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java
index 2f6670c195..693a6d855b 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java
@@ -71,9 +71,9 @@ public final class RequestMappingInfo implements RequestCondition custom) {
+ public RequestMappingInfo(@Nullable String name, @Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
+ @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
+ @Nullable ProducesRequestCondition produces, @Nullable RequestCondition> custom) {
this.name = (StringUtils.hasText(name) ? name : null);
this.patternsCondition = (patterns != null ? patterns : new PatternsRequestCondition());
@@ -88,9 +88,9 @@ public final class RequestMappingInfo implements RequestCondition custom) {
+ public RequestMappingInfo(@Nullable PatternsRequestCondition patterns, @Nullable RequestMethodsRequestCondition methods,
+ @Nullable ParamsRequestCondition params, @Nullable HeadersRequestCondition headers, @Nullable ConsumesRequestCondition consumes,
+ @Nullable ProducesRequestCondition produces, @Nullable RequestCondition> custom) {
this(null, patterns, methods, params, headers, consumes, produces, custom);
}
@@ -98,7 +98,7 @@ public final class RequestMappingInfo implements RequestCondition customRequestCondition) {
+ public RequestMappingInfo(RequestMappingInfo info, @Nullable RequestCondition> customRequestCondition) {
this(info.name, info.patternsCondition, info.methodsCondition, info.paramsCondition, info.headersCondition,
info.consumesCondition, info.producesCondition, customRequestCondition);
}