Skip to content

Commit 186deb7

Browse files
committed
Update deprecation notices on rawStatusCode
Mark for removal where not marked, and set to 7.0 consistently as the target for removal. See gh-33440
1 parent 57cb8c7 commit 186deb7

27 files changed

+36
-36
lines changed

spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public HttpStatusCode getStatus() {
179179
/**
180180
* Return the HTTP status code as an integer.
181181
* @since 5.1.10
182-
* @deprecated as of 6.0, in favor of {@link #getStatus()}
182+
* @deprecated in favor of {@link #getStatus()}, for removal in 7.0
183183
*/
184184
@Deprecated(since = "6.0", forRemoval = true)
185185
public int getRawStatusCode() {

spring-web/src/main/java/org/springframework/http/client/AbstractClientHttpResponse.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
*
2626
* @author Arjen Poutsma
2727
* @since 3.1.1
28-
* @deprecated as of 6.0, with no direct replacement; scheduled for removal in 6.2
28+
* @deprecated with no direct replacement; for removal in 6.2
2929
*/
3030
@Deprecated(since = "6.0", forRemoval = true)
3131
public abstract class AbstractClientHttpResponse implements ClientHttpResponse {

spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
4848
* @throws IOException in case of I/O errors
4949
* @since 3.1.1
5050
* @see #getStatusCode()
51-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}; scheduled for
52-
* removal in 6.2
51+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
5352
*/
5453
@Deprecated(since = "6.0", forRemoval = true)
5554
default int getRawStatusCode() throws IOException {

spring-web/src/main/java/org/springframework/http/client/reactive/ClientHttpResponse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ default String getId() {
5151
* @return the HTTP status as an integer value
5252
* @since 5.0.6
5353
* @see #getStatusCode()
54-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
54+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
5555
*/
5656
@Deprecated(since = "6.0", forRemoval = true)
5757
default int getRawStatusCode() {

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpResponse.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -115,13 +115,6 @@ public boolean setRawStatusCode(@Nullable Integer statusCode) {
115115
return setStatusCode(statusCode != null ? HttpStatusCode.valueOf(statusCode) : null);
116116
}
117117

118-
@Deprecated
119-
@Override
120-
@Nullable
121-
public Integer getRawStatusCode() {
122-
return (this.statusCode != null ? this.statusCode.value() : null);
123-
}
124-
125118
@Override
126119
public HttpHeaders getHeaders() {
127120
if (this.readOnlyHeaders != null) {

spring-web/src/main/java/org/springframework/http/server/reactive/ReactorNetty2ServerHttpResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public HttpStatusCode getStatusCode() {
7878

7979
@Override
8080
@Deprecated
81+
@SuppressWarnings("removal")
8182
public Integer getRawStatusCode() {
8283
Integer status = super.getRawStatusCode();
8384
return (status != null ? status : this.response.status().code());

spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public HttpStatusCode getStatusCode() {
7777

7878
@Override
7979
@Deprecated
80+
@SuppressWarnings("removal")
8081
public Integer getRawStatusCode() {
8182
Integer status = super.getRawStatusCode();
8283
return (status != null ? status : this.response.status().code());

spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpResponse.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ default boolean setRawStatusCode(@Nullable Integer value) {
6565
* status of the response from the underlying server. The return value may
6666
* be {@code null} if there is no default value from the underlying server.
6767
* @since 5.2.4
68-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
68+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
6969
*/
70-
@Deprecated(since = "6.0")
70+
@Deprecated(since = "6.0", forRemoval = true)
7171
@Nullable
7272
default Integer getRawStatusCode() {
7373
HttpStatusCode httpStatus = getStatusCode();

spring-web/src/main/java/org/springframework/http/server/reactive/ServerHttpResponseDecorator.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,6 +74,7 @@ public boolean setRawStatusCode(@Nullable Integer value) {
7474
@Override
7575
@Nullable
7676
@Deprecated
77+
@SuppressWarnings("removal")
7778
public Integer getRawStatusCode() {
7879
return getDelegate().getRawStatusCode();
7980
}

spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public HttpStatusCode getStatusCode() {
109109

110110
@Override
111111
@Deprecated
112+
@SuppressWarnings("removal")
112113
public Integer getRawStatusCode() {
113114
Integer status = super.getRawStatusCode();
114115
return (status != null ? status : this.response.getStatus());

spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public HttpStatusCode getStatusCode() {
8989

9090
@Override
9191
@Deprecated
92+
@SuppressWarnings("removal")
9293
public Integer getRawStatusCode() {
9394
Integer status = super.getRawStatusCode();
9495
return (status != null ? status : this.exchange.getStatusCode());

spring-web/src/main/java/org/springframework/web/client/RestClientResponseException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public HttpStatusCode getStatusCode() {
125125

126126
/**
127127
* Return the raw HTTP status code value.
128-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
128+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
129129
*/
130130
@Deprecated(since = "6.0")
131131
public int getRawStatusCode() {

spring-web/src/main/java/org/springframework/web/client/UnknownContentTypeException.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ public HttpStatusCode getStatusCode() {
113113

114114
/**
115115
* Return the raw HTTP status code value.
116-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
116+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
117117
*/
118118
@Deprecated(since = "6.0")
119119
public int getRawStatusCode() {

spring-web/src/main/java/org/springframework/web/server/handler/ResponseStatusExceptionHandler.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ protected HttpStatusCode determineStatus(Throwable ex) {
132132
* @param ex the exception to check
133133
* @return the associated HTTP status code, or -1 if it can't be derived.
134134
* @since 5.3
135-
* @deprecated as of 6.0, in favor of {@link #determineStatus(Throwable)}
135+
* @deprecated in favor of {@link #determineStatus(Throwable)}, for removal in 7.0
136136
*/
137-
@Deprecated(since = "6.0")
137+
@Deprecated(since = "6.0", forRemoval = true)
138138
protected int determineRawStatusCode(Throwable ex) {
139139
if (ex instanceof ResponseStatusException responseStatusException) {
140140
return responseStatusException.getStatusCode().value();

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public interface ClientResponse {
6161
* Return the raw status code of this response.
6262
* @return the HTTP status as an integer value
6363
* @since 5.1
64-
* @deprecated as of 6.0, in favor of {@link #statusCode()}
64+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
6565
*/
6666
@Deprecated(since = "6.0", forRemoval = true)
6767
default int rawStatusCode() {

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ interface ResponseSpec {
795795
* .retrieve()
796796
* .bodyToMono(Account.class)
797797
* .onErrorResume(WebClientResponseException.class,
798-
* ex -> ex.getRawStatusCode() == 404 ? Mono.empty() : Mono.error(ex));
798+
* ex -> ex.getStatusCode().value() == 404 ? Mono.empty() : Mono.error(ex));
799799
* </pre>
800800
* @param statusPredicate to match responses with
801801
* @param exceptionFunction to map the response to an error signal

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientResponseException.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public HttpStatusCode getStatusCode() {
172172

173173
/**
174174
* Return the raw HTTP status code value.
175-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
175+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
176176
*/
177177
@Deprecated(since = "6.0")
178178
public int getRawStatusCode() {

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

+1
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ public final HttpStatusCode statusCode() {
323323

324324
@Override
325325
@Deprecated
326+
@SuppressWarnings("removal")
326327
public int rawStatusCode() {
327328
return this.statusCode.value();
328329
}

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,9 +70,9 @@ public interface ServerResponse {
7070
* Return the status code of this response as integer.
7171
* @return the status as an integer
7272
* @since 5.2
73-
* @deprecated as of 6.0, in favor of {@link #statusCode()}
73+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
7474
*/
75-
@Deprecated(since = "6.0")
75+
@Deprecated(since = "6.0", forRemoval = true)
7676
int rawStatusCode();
7777

7878
/**

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultEntityResponseBuilderTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void fromProducer() {
8484
}
8585

8686
@Test
87-
@SuppressWarnings("deprecation")
87+
@SuppressWarnings("removal")
8888
void status() {
8989
String body = "foo";
9090
Mono<EntityResponse<String>> result = EntityResponse.fromObject(body).status(HttpStatus.CREATED).build();

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void from() {
8080
}
8181

8282
@Test
83-
@SuppressWarnings("deprecation")
83+
@SuppressWarnings("removal")
8484
void status() {
8585
Mono<ServerResponse> result = ServerResponse.status(HttpStatus.CREATED).build();
8686
StepVerifier.create(result)

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {
223223
public HttpStatus statusCode() {
224224
return HttpStatus.OK;
225225
}
226-
@SuppressWarnings("deprecation")
226+
@SuppressWarnings("removal")
227227
@Override
228228
public int rawStatusCode() {
229229
return 200;
@@ -262,7 +262,7 @@ void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {
262262
public HttpStatus statusCode() {
263263
return HttpStatus.OK;
264264
}
265-
@SuppressWarnings("deprecation")
265+
@SuppressWarnings("removal")
266266
@Override
267267
public int rawStatusCode() {
268268
return 200;

spring-webmvc/src/main/java/org/springframework/web/servlet/function/AbstractServerResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public final HttpStatusCode statusCode() {
6767

6868
@Override
6969
@Deprecated
70+
@SuppressWarnings("removal")
7071
public int rawStatusCode() {
7172
return this.statusCode.value();
7273
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultAsyncServerResponse.java

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public HttpStatusCode statusCode() {
8989

9090
@Override
9191
@Deprecated
92+
@SuppressWarnings("removal")
9293
public int rawStatusCode() {
9394
return delegate(ServerResponse::rawStatusCode);
9495
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public interface ServerResponse {
6868
/**
6969
* Return the status code of this response as integer.
7070
* @return the status as an integer
71-
* @deprecated as of 6.0, in favor of {@link #statusCode()}
71+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
7272
*/
73-
@Deprecated(since = "6.0")
73+
@Deprecated(since = "6.0", forRemoval = true)
7474
int rawStatusCode();
7575

7676
/**

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void fromObjectTypeReference() {
6666
}
6767

6868
@Test
69-
@SuppressWarnings("deprecation")
69+
@SuppressWarnings("removal")
7070
void status() {
7171
String body = "foo";
7272
EntityResponse<String> result =

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DefaultServerResponseBuilderTests {
5555
static final ServerResponse.Context EMPTY_CONTEXT = Collections::emptyList;
5656

5757
@Test
58-
@SuppressWarnings("deprecation")
58+
@SuppressWarnings("removal")
5959
void status() {
6060
ServerResponse response = ServerResponse.status(HttpStatus.CREATED).build();
6161
assertThat(response.statusCode()).isEqualTo(HttpStatus.CREATED);

0 commit comments

Comments
 (0)