Fix overridden methods nullability
Issue: SPR-15869
This commit is contained in:
@@ -30,6 +30,7 @@ import reactor.core.publisher.Mono;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.reactive.function.BodyInserters;
|
||||
|
||||
/**
|
||||
@@ -129,6 +130,7 @@ class ResourceHandlerFunction implements HandlerFunction<ServerResponse> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return this.delegate.getFilename();
|
||||
}
|
||||
|
||||
@@ -88,18 +88,22 @@ public class GzipResourceResolver extends AbstractResourceResolver {
|
||||
this.gzipped = original.createRelative(original.getFilename() + ".gz");
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
return this.gzipped.getInputStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists() {
|
||||
return this.gzipped.exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadable() {
|
||||
return this.gzipped.isReadable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpen() {
|
||||
return this.gzipped.isOpen();
|
||||
}
|
||||
@@ -109,34 +113,43 @@ public class GzipResourceResolver extends AbstractResourceResolver {
|
||||
return this.gzipped.isFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getURL() throws IOException {
|
||||
return this.gzipped.getURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getURI() throws IOException {
|
||||
return this.gzipped.getURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFile() throws IOException {
|
||||
return this.gzipped.getFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long contentLength() throws IOException {
|
||||
return this.gzipped.contentLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long lastModified() throws IOException {
|
||||
return this.gzipped.lastModified();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource createRelative(String relativePath) throws IOException {
|
||||
return this.gzipped.createRelative(relativePath);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return this.original.getFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.gzipped.getDescription();
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFilename() {
|
||||
return this.original.getFilename();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.web.reactive.result.condition;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
/**
|
||||
@@ -30,6 +31,7 @@ abstract class AbstractNameValueExpression<T> implements NameValueExpression<T>
|
||||
|
||||
protected final String name;
|
||||
|
||||
@Nullable
|
||||
protected final T value;
|
||||
|
||||
protected final boolean isNegated;
|
||||
@@ -54,6 +56,7 @@ abstract class AbstractNameValueExpression<T> implements NameValueExpression<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.cors.reactive.CorsUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
@@ -107,6 +108,7 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
|
||||
* or {@code null} otherwise.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public HeadersRequestCondition getMatchingCondition(ServerWebExchange exchange) {
|
||||
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
|
||||
return PRE_FLIGHT_MATCH;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.web.reactive.result.condition;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A contract for {@code "name!=value"} style expression used to specify request
|
||||
* parameters and request header conditions in {@code @RequestMapping}.
|
||||
@@ -27,6 +29,7 @@ public interface NameValueExpression<T> {
|
||||
|
||||
String getName();
|
||||
|
||||
@Nullable
|
||||
T getValue();
|
||||
|
||||
boolean isNegated();
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.web.accept.ContentNegotiationManager;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.cors.reactive.CorsUtils;
|
||||
@@ -181,6 +182,7 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
|
||||
* or {@code null} if no expressions match.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public ProducesRequestCondition getMatchingCondition(ServerWebExchange exchange) {
|
||||
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
|
||||
return PRE_FLIGHT_MATCH;
|
||||
|
||||
@@ -103,6 +103,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
* request method is OPTIONS.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public RequestMethodsRequestCondition getMatchingCondition(ServerWebExchange exchange) {
|
||||
if (CorsUtils.isPreFlightRequest(exchange.getRequest())) {
|
||||
return matchPreFlight(exchange.getRequest());
|
||||
@@ -129,6 +130,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
|
||||
return matchRequestMethod(expectedMethod);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private RequestMethodsRequestCondition matchRequestMethod(@Nullable HttpMethod httpMethod) {
|
||||
if (httpMethod != null) {
|
||||
for (RequestMethod method : getMethods()) {
|
||||
|
||||
@@ -189,6 +189,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
methods, params, headers, consumes, produces, custom.getCondition());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String combineNames(RequestMappingInfo other) {
|
||||
if (this.name != null && other.name != null) {
|
||||
String separator = "#";
|
||||
@@ -210,6 +211,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
* @return a new instance in case all conditions match; or {@code null} otherwise
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public RequestMappingInfo getMatchingCondition(ServerWebExchange exchange) {
|
||||
RequestMethodsRequestCondition methods = this.methodsCondition.getMatchingCondition(exchange);
|
||||
ParamsRequestCondition params = this.paramsCondition.getMatchingCondition(exchange);
|
||||
|
||||
@@ -46,7 +46,6 @@ public interface Rendering {
|
||||
/**
|
||||
* Return the selected {@link String} view name or {@link View} object.
|
||||
*/
|
||||
@Nullable
|
||||
Object view();
|
||||
|
||||
/**
|
||||
|
||||
@@ -224,6 +224,7 @@ public abstract class AbstractListenerWebSocketSession<T> extends AbstractWebSoc
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected WebSocketMessage read() throws IOException {
|
||||
if (this.webSocketMessage != null) {
|
||||
WebSocketMessage result = this.webSocketMessage;
|
||||
|
||||
Reference in New Issue
Block a user