Nullability refinements on private and static methods

Based on IntelliJ IDEA 2017.3 introspection results.

Issue: SPR-15756
This commit is contained in:
Juergen Hoeller
2017-09-22 18:22:12 +02:00
parent 60f47f4489
commit 7ae59d0c2a
88 changed files with 319 additions and 300 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.handler.annotation.DestinationVariable;
import org.springframework.messaging.handler.annotation.ValueConstants;
import org.springframework.util.Assert;
/**
* Resolves method parameters annotated with
@@ -52,6 +53,7 @@ public class DestinationVariableMethodArgumentResolver extends AbstractNamedValu
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
DestinationVariable annotation = parameter.getParameterAnnotation(DestinationVariable.class);
Assert.state(annotation != null, "No DestinationVariable annotation");
return new DestinationVariableNamedValueInfo(annotation);
}

View File

@@ -30,6 +30,7 @@ import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandlingException;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
import org.springframework.util.Assert;
/**
* Resolves method parameters annotated with {@link Header @Header}.
@@ -55,6 +56,7 @@ public class HeaderMethodArgumentResolver extends AbstractNamedValueMethodArgume
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
Header annotation = parameter.getParameterAnnotation(Header.class);
Assert.state(annotation != null, "No Header annotation");
return new HeaderNamedValueInfo(annotation);
}

View File

@@ -522,6 +522,7 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
return (credentials != null ? credentials.passcode : null);
}
@Nullable
public static Integer getContentLength(Map<String, List<String>> nativeHeaders) {
List<String> values = nativeHeaders.get(STOMP_CONTENT_LENGTH_HEADER);
return (!CollectionUtils.isEmpty(values) ? Integer.valueOf(values.get(0)) : null);

View File

@@ -161,6 +161,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
return null;
}
@Nullable
private ParseResult parseSubscriptionMessage(Message<?> message, String sourceDestination) {
MessageHeaders headers = message.getHeaders();
String sessionId = SimpMessageHeaderAccessor.getSessionId(headers);