Make getters and setters null-safety consistent

This commit ensure that null-safety is consistent between
getters and setters in order to be able to provide beans
with properties with a common type when type safety is
taken in account like with Kotlin.

It also add a few missing property level @Nullable
annotations.

Issue: SPR-15792
This commit is contained in:
Sebastien Deleuze
2017-07-19 08:55:05 +02:00
parent ff85726fa9
commit fb4ddb0746
201 changed files with 579 additions and 489 deletions

View File

@@ -87,7 +87,7 @@ public class WebSocketHttpHeaders extends HttpHeaders {
* Sets the (new) value of the {@code Sec-WebSocket-Accept} header.
* @param secWebSocketAccept the value of the header
*/
public void setSecWebSocketAccept(String secWebSocketAccept) {
public void setSecWebSocketAccept(@Nullable String secWebSocketAccept) {
set(SEC_WEBSOCKET_ACCEPT, secWebSocketAccept);
}
@@ -134,7 +134,7 @@ public class WebSocketHttpHeaders extends HttpHeaders {
* Sets the (new) value of the {@code Sec-WebSocket-Key} header.
* @param secWebSocketKey the value of the header
*/
public void setSecWebSocketKey(String secWebSocketKey) {
public void setSecWebSocketKey(@Nullable String secWebSocketKey) {
set(SEC_WEBSOCKET_KEY, secWebSocketKey);
}
@@ -184,7 +184,7 @@ public class WebSocketHttpHeaders extends HttpHeaders {
* Sets the (new) value of the {@code Sec-WebSocket-Version} header.
* @param secWebSocketVersion the value of the header
*/
public void setSecWebSocketVersion(String secWebSocketVersion) {
public void setSecWebSocketVersion(@Nullable String secWebSocketVersion) {
set(SEC_WEBSOCKET_VERSION, secWebSocketVersion);
}
@@ -232,7 +232,7 @@ public class WebSocketHttpHeaders extends HttpHeaders {
* @see #add(String, String)
*/
@Override
public void set(String headerName, String headerValue) {
public void set(String headerName, @Nullable String headerValue) {
this.headers.set(headerName, headerValue);
}

View File

@@ -86,7 +86,7 @@ public class WebSocketConnectionManager extends ConnectionManagerSupport {
/**
* Set the origin to use.
*/
public void setOrigin(String origin) {
public void setOrigin(@Nullable String origin) {
this.headers.setOrigin(origin);
}

View File

@@ -84,7 +84,7 @@ public abstract class AbstractWebSocketHandlerRegistration<M> implements WebSock
}
@Override
public WebSocketHandlerRegistration setHandshakeHandler(HandshakeHandler handshakeHandler) {
public WebSocketHandlerRegistration setHandshakeHandler(@Nullable HandshakeHandler handshakeHandler) {
this.handshakeHandler = handshakeHandler;
return this;
}

View File

@@ -92,7 +92,7 @@ public class ServletWebSocketHandlerRegistry implements WebSocketHandlerRegistry
* Set the UrlPathHelper to configure on the {@code SimpleUrlHandlerMapping}
* used to map handshake requests.
*/
public void setUrlPathHelper(UrlPathHelper urlPathHelper) {
public void setUrlPathHelper(@Nullable UrlPathHelper urlPathHelper) {
this.urlPathHelper = urlPathHelper;
}

View File

@@ -125,7 +125,7 @@ public class WebMvcStompEndpointRegistry implements StompEndpointRegistry {
* used to map handshake requests.
*/
@Override
public void setUrlPathHelper(UrlPathHelper urlPathHelper) {
public void setUrlPathHelper(@Nullable UrlPathHelper urlPathHelper) {
this.urlPathHelper = urlPathHelper;
}

View File

@@ -176,7 +176,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
* client inbound channel.
* <p>By default this property is not set.
*/
public void setHeaderInitializer(MessageHeaderInitializer headerInitializer) {
public void setHeaderInitializer(@Nullable MessageHeaderInitializer headerInitializer) {
this.headerInitializer = headerInitializer;
this.stompDecoder.setHeaderInitializer(headerInitializer);
}

View File

@@ -172,7 +172,7 @@ public class SubProtocolWebSocketHandler
* sub-protocol.
* @param defaultProtocolHandler the default handler
*/
public void setDefaultProtocolHandler(SubProtocolHandler defaultProtocolHandler) {
public void setDefaultProtocolHandler(@Nullable SubProtocolHandler defaultProtocolHandler) {
this.defaultProtocolHandler = defaultProtocolHandler;
if (this.protocolHandlerLookup.isEmpty()) {
setProtocolHandlers(Collections.singletonList(defaultProtocolHandler));

View File

@@ -76,7 +76,7 @@ public class ServerEndpointExporter extends WebApplicationObjectSupport
* Set the JSR-356 {@link ServerContainer} to use for endpoint registration.
* If not set, the container is going to be retrieved via the {@code ServletContext}.
*/
public void setServerContainer(ServerContainer serverContainer) {
public void setServerContainer(@Nullable ServerContainer serverContainer) {
this.serverContainer = serverContainer;
}

View File

@@ -134,7 +134,7 @@ public class SockJsClient implements WebSocketClient, Lifecycle {
*
* @param httpHeaderNames HTTP header names
*/
public void setHttpHeaderNames(String... httpHeaderNames) {
public void setHttpHeaderNames(@Nullable String... httpHeaderNames) {
this.httpHeaderNames = httpHeaderNames;
}