Skip to content

Commit b332920

Browse files
committed
Refine null-safety in the spring-webflux module
Closes gh-34163
1 parent 5fba926 commit b332920

File tree

7 files changed

+7
-8
lines changed

7 files changed

+7
-8
lines changed

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/config/ResourceChainRegistration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public ResourceChainRegistration(boolean cacheResources) {
6565
this(cacheResources, cacheResources ? new ConcurrentMapCache(DEFAULT_CACHE_NAME) : null);
6666
}
6767

68-
@SuppressWarnings("NullAway")
68+
@SuppressWarnings("NullAway") // Dataflow analysis limitation
6969
public ResourceChainRegistration(boolean cacheResources, @Nullable Cache cache) {
7070
Assert.isTrue(!cacheResources || cache != null, "'cache' is required when cacheResources=true");
7171
if (cacheResources) {

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public DefaultServerResponseBuilder(HttpStatusCode status) {
9191

9292

9393
@Override
94-
@SuppressWarnings("NullAway") // TODO NullAway bug potentially due to the recursive generic type
94+
@SuppressWarnings("NullAway") // https://github.com/uber/NullAway/issues/1113
9595
public ServerResponse.BodyBuilder header(String headerName, @Nullable String... headerValues) {
9696
Assert.notNull(headerName, "HeaderName must not be null");
9797
for (String headerValue : headerValues) {

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceWebHandler.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ public boolean isOptimizeLocations() {
323323
* @param mediaTypes media type mappings
324324
* @since 5.3.2
325325
*/
326-
@SuppressWarnings("NullAway")
327326
public void setMediaTypes(Map<String, MediaType> mediaTypes) {
328327
if (this.mediaTypes == null) {
329328
this.mediaTypes = new HashMap<>(mediaTypes.size());
@@ -474,7 +473,7 @@ public Mono<Void> handle(ServerWebExchange exchange) {
474473
});
475474
}
476475

477-
@SuppressWarnings("NullAway")
476+
@SuppressWarnings("NullAway") // Lambda
478477
protected Mono<Resource> getResource(ServerWebExchange exchange) {
479478
String rawPath = getResourcePath(exchange);
480479
String path = processPath(rawPath);

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/result/method/AbstractHandlerMethodMapping.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public Mono<HandlerMethod> getHandlerInternal(ServerWebExchange exchange) {
359359
}
360360
}
361361

362-
@SuppressWarnings("NullAway")
362+
@SuppressWarnings("NullAway") // Dataflow analysis limitation
363363
private void addMatchingMappings(Collection<T> mappings, List<Match> matches, ServerWebExchange exchange) {
364364
for (T mapping : mappings) {
365365
T match = getMatchingMapping(mapping, exchange);

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ControllerMethodResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private InvocableHandlerMethod createAttributeMethod(Object bean, Method method)
408408
* @param handlerMethod the controller method that raised the exception,
409409
* or if {@code null}, check only {@code @ControllerAdvice} classes.
410410
*/
411-
@SuppressWarnings("NullAway")
411+
@SuppressWarnings("NullAway") // Dataflow analysis limitation
412412
public @Nullable InvocableHandlerMethod getExceptionHandlerMethod(Throwable ex, ServerWebExchange exchange, @Nullable HandlerMethod handlerMethod) {
413413

414414
Class<?> handlerType = (handlerMethod != null ? handlerMethod.getBeanType() : null);

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketHandlerAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public StandardWebSocketHandlerAdapter(WebSocketHandler handler,
6464

6565

6666
@Override
67-
@SuppressWarnings("NullAway")
67+
@SuppressWarnings("NullAway") // Lambda
6868
public void onOpen(Session session, EndpointConfig config) {
6969
this.delegateSession = this.sessionFactory.apply(session);
7070
Assert.state(this.delegateSession != null, "No delegate session");

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private Mono<Void> handleBadRequest(ServerWebExchange exchange, String reason) {
241241
return null;
242242
}
243243

244-
@SuppressWarnings("NullAway")
244+
@SuppressWarnings("NullAway") // Lambda
245245
private Mono<Map<String, Object>> initAttributes(ServerWebExchange exchange) {
246246
if (this.sessionAttributePredicate == null) {
247247
return EMPTY_ATTRIBUTES;

0 commit comments

Comments
 (0)