Consistent use of @Nullable in spring-test

This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
This commit is contained in:
Juergen Hoeller
2017-06-08 22:52:57 +02:00
parent ee5fa2633a
commit fd53d2a51a
134 changed files with 812 additions and 777 deletions

View File

@@ -28,7 +28,6 @@ import org.springframework.core.ResolvableType;
import org.springframework.lang.Nullable;
import org.springframework.messaging.Message;
import org.springframework.messaging.handler.HandlerMethod;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
@@ -289,9 +288,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
@Override
public Type getGenericParameterType() {
Type returnType = this.returnType.getType();
Assert.state(returnType != null, "No return type");
return returnType;
return this.returnType.getType();
}
@Override

View File

@@ -417,7 +417,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
}
@Override
public void addAll(String headerName, List<String> headerValues) {
public void addAll(String headerName, List<? extends String> headerValues) {
List<String> currentValues = headers.computeIfAbsent(headerName, k -> new LinkedList<>());
currentValues.addAll(headerValues);
}