Polishing.

Use Spring's nullability annotations where used as part of API nullability indicators.

See #2385
This commit is contained in:
Mark Paluch
2021-06-17 08:48:56 +02:00
parent e57238fe60
commit c24ba262ca
39 changed files with 125 additions and 149 deletions

View File

@@ -15,10 +15,9 @@
*/
package org.springframework.data.web;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.springframework.core.MethodParameter;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.web.util.UriComponents;
@@ -53,7 +52,7 @@ class MethodParameterAwarePagedResourcesAssembler<T> extends PagedResourcesAssem
* (non-Javadoc)
* @see org.springframework.data.web.PagedResourcesAssembler#getMethodParameter()
*/
@Nonnull
@NonNull
@Override
protected MethodParameter getMethodParameter() {
return parameter;

View File

@@ -15,10 +15,9 @@
*/
package org.springframework.data.web;
import javax.annotation.Nonnull;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.Pageable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebDataBinderFactory;
@@ -48,7 +47,7 @@ public interface PageableArgumentResolver extends HandlerMethodArgumentResolver
* @param binderFactory a factory for creating {@link WebDataBinder} instances
* @return the resolved argument value.
*/
@Nonnull
@NonNull
@Override
Pageable resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory);

View File

@@ -18,10 +18,9 @@ package org.springframework.data.web;
import java.lang.reflect.Method;
import java.util.List;
import javax.annotation.Nonnull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.MethodParameter;
import org.springframework.core.log.LogMessage;
@@ -29,6 +28,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.server.MethodLinkBuilderFactory;
import org.springframework.hateoas.server.core.MethodParameters;
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilderFactory;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
@@ -91,7 +91,7 @@ public class PagedResourcesAssemblerArgumentResolver implements HandlerMethodArg
* (non-Javadoc)
* @see org.springframework.web.method.support.HandlerMethodArgumentResolver#resolveArgument(org.springframework.core.MethodParameter, org.springframework.web.method.support.ModelAndViewContainer, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.bind.support.WebDataBinderFactory)
*/
@Nonnull
@NonNull
@Override
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) {

View File

@@ -15,12 +15,11 @@
*/
package org.springframework.data.web;
import javax.annotation.Nonnull;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.BindingContext;
@@ -74,7 +73,7 @@ public class ReactivePageableHandlerMethodArgumentResolver extends PageableHandl
* (non-Javadoc)
* @see org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver#resolveArgumentValue(org.springframework.core.MethodParameter, org.springframework.web.reactive.BindingContext, org.springframework.web.server.ServerWebExchange)
*/
@Nonnull
@NonNull
@Override
public Pageable resolveArgumentValue(MethodParameter parameter, BindingContext bindingContext,
ServerWebExchange exchange) {

View File

@@ -17,10 +17,9 @@ package org.springframework.data.web;
import java.util.List;
import javax.annotation.Nonnull;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.Sort;
import org.springframework.lang.NonNull;
import org.springframework.util.StringUtils;
import org.springframework.web.reactive.BindingContext;
import org.springframework.web.reactive.result.method.HandlerMethodArgumentResolver;
@@ -50,7 +49,7 @@ public class ReactiveSortHandlerMethodArgumentResolver extends SortHandlerMethod
*(non-Javadoc)
* @see org.springframework.web.reactive.result.method.SyncHandlerMethodArgumentResolver#resolveArgumentValue(org.springframework.core.MethodParameter, org.springframework.web.reactive.BindingContext, org.springframework.web.server.ServerWebExchange)
*/
@Nonnull
@NonNull
@Override
public Sort resolveArgumentValue(MethodParameter parameter, BindingContext bindingContext,
ServerWebExchange exchange) {

View File

@@ -15,11 +15,10 @@
*/
package org.springframework.data.web;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.Sort;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
@@ -48,7 +47,7 @@ public interface SortArgumentResolver extends HandlerMethodArgumentResolver {
* @param binderFactory a factory for creating {@link WebDataBinder} instances
* @return the resolved argument value, or {@code null}
*/
@Nonnull
@NonNull
@Override
Sort resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer,
NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory);

View File

@@ -17,10 +17,9 @@ package org.springframework.data.web;
import java.util.Arrays;
import javax.annotation.Nullable;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.Sort;
import org.springframework.lang.Nullable;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;

View File

@@ -18,7 +18,6 @@ package org.springframework.data.web;
import java.io.IOException;
import java.util.Map;
import javax.annotation.Nullable;
import javax.xml.parsers.DocumentBuilderFactory;
import org.springframework.core.ResolvableType;
@@ -30,8 +29,10 @@ import org.springframework.http.converter.AbstractHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.xml.sax.SAXParseException;
import org.xmlbeam.XBProjector;
import org.xmlbeam.config.DefaultXMLFactoriesConfig;