Refine null-safety in the spring-webflux module
Closes gh-34163
This commit is contained in:
@@ -65,7 +65,7 @@ public class ResourceChainRegistration {
|
||||
this(cacheResources, cacheResources ? new ConcurrentMapCache(DEFAULT_CACHE_NAME) : null);
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Dataflow analysis limitation
|
||||
public ResourceChainRegistration(boolean cacheResources, @Nullable Cache cache) {
|
||||
Assert.isTrue(!cacheResources || cache != null, "'cache' is required when cacheResources=true");
|
||||
if (cacheResources) {
|
||||
|
||||
@@ -91,7 +91,7 @@ class DefaultServerResponseBuilder implements ServerResponse.BodyBuilder {
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NullAway") // TODO NullAway bug potentially due to the recursive generic type
|
||||
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113
|
||||
public ServerResponse.BodyBuilder header(String headerName, @Nullable String... headerValues) {
|
||||
Assert.notNull(headerName, "HeaderName must not be null");
|
||||
for (String headerValue : headerValues) {
|
||||
|
||||
@@ -323,7 +323,6 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||
* @param mediaTypes media type mappings
|
||||
* @since 5.3.2
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
public void setMediaTypes(Map<String, MediaType> mediaTypes) {
|
||||
if (this.mediaTypes == null) {
|
||||
this.mediaTypes = new HashMap<>(mediaTypes.size());
|
||||
@@ -474,7 +473,7 @@ public class ResourceWebHandler implements WebHandler, InitializingBean {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lambda
|
||||
protected Mono<Resource> getResource(ServerWebExchange exchange) {
|
||||
String rawPath = getResourcePath(exchange);
|
||||
String path = processPath(rawPath);
|
||||
|
||||
@@ -359,7 +359,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Dataflow analysis limitation
|
||||
private void addMatchingMappings(Collection<T> mappings, List<Match> matches, ServerWebExchange exchange) {
|
||||
for (T mapping : mappings) {
|
||||
T match = getMatchingMapping(mapping, exchange);
|
||||
|
||||
@@ -408,7 +408,7 @@ class ControllerMethodResolver {
|
||||
* @param handlerMethod the controller method that raised the exception,
|
||||
* or if {@code null}, check only {@code @ControllerAdvice} classes.
|
||||
*/
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Dataflow analysis limitation
|
||||
public @Nullable InvocableHandlerMethod getExceptionHandlerMethod(Throwable ex, ServerWebExchange exchange, @Nullable HandlerMethod handlerMethod) {
|
||||
|
||||
Class<?> handlerType = (handlerMethod != null ? handlerMethod.getBeanType() : null);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class StandardWebSocketHandlerAdapter extends Endpoint {
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lambda
|
||||
public void onOpen(Session session, EndpointConfig config) {
|
||||
this.delegateSession = this.sessionFactory.apply(session);
|
||||
Assert.state(this.delegateSession != null, "No delegate session");
|
||||
|
||||
@@ -241,7 +241,7 @@ public class HandshakeWebSocketService implements WebSocketService, Lifecycle {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullAway")
|
||||
@SuppressWarnings("NullAway") // Lambda
|
||||
private Mono<Map<String, Object>> initAttributes(ServerWebExchange exchange) {
|
||||
if (this.sessionAttributePredicate == null) {
|
||||
return EMPTY_ATTRIBUTES;
|
||||
|
||||
Reference in New Issue
Block a user