Add since and forRemoval to @Deprecated

This commit is contained in:
rstoyanchev
2025-01-16 11:29:35 +00:00
parent 5f6df35ec4
commit eb15b26abe
10 changed files with 51 additions and 55 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -107,9 +107,9 @@ public class HttpEntity<T> {
/**
* Create a new {@code HttpEntity} with the given headers and no body.
* @param headers the entity headers
* @deprecated Use {@link #HttpEntity(HttpHeaders)}
* @deprecated in favor of {@link #HttpEntity(HttpHeaders)}
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public HttpEntity(MultiValueMap<String, String> headers) {
this(null, headers);
}
@@ -118,9 +118,9 @@ public class HttpEntity<T> {
* Create a new {@code HttpEntity} with the given body and headers.
* @param body the entity body
* @param headers the entity headers
* @deprecated Use {@link #HttpEntity(Object, HttpHeaders)}
* @deprecated in favor of {@link #HttpEntity(Object, HttpHeaders)}
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public HttpEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers) {
this.body = body;
this.headers = HttpHeaders.readOnlyHttpHeaders(headers != null ? new HttpHeaders(headers) : new HttpHeaders());

View File

@@ -1847,11 +1847,11 @@ public class HttpHeaders implements Serializable {
* casing variants of a given header name, see {@link #asMultiValueMap()}
* javadoc.
* @return a single value representation of these headers
* @deprecated Use {@link #toSingleValueMap()} which performs a copy but
* @deprecated in favor of {@link #toSingleValueMap()} which performs a copy but
* ensures that collection-iterating methods like {@code entrySet()} are
* case-insensitive
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public Map<String, String> asSingleValueMap() {
return this.headers.asSingleValueMap();
}
@@ -1870,7 +1870,7 @@ public class HttpHeaders implements Serializable {
* that would only accept maps. Generally avoid using HttpHeaders as a Map
* or MultiValueMap.
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public MultiValueMap<String, String> asMultiValueMap() {
return this.headers;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,14 +120,16 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
return Collections.unmodifiableMap(this.headers.toSingleValueMap());
}
@SuppressWarnings("removal")
@Override
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public Map<String, String> asSingleValueMap() {
return Collections.unmodifiableMap(this.headers.asSingleValueMap());
}
@SuppressWarnings("removal")
@Override
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public MultiValueMap<String, String> asMultiValueMap() {
return CollectionUtils.unmodifiableMultiValueMap(this.headers);
}

View File

@@ -152,9 +152,9 @@ public class RequestEntity<T> extends HttpEntity<T> {
* @param headers the headers
* @param method the method
* @param url the URL
* @deprecated Use {@link #RequestEntity(HttpHeaders, HttpMethod, URI)}
* @deprecated in favor of {@link #RequestEntity(HttpHeaders, HttpMethod, URI)}
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public RequestEntity(MultiValueMap<String, String> headers, HttpMethod method, URI url) {
this(null, headers, method, url, null);
}
@@ -165,10 +165,11 @@ public class RequestEntity<T> extends HttpEntity<T> {
* @param headers the headers
* @param method the method
* @param url the URL
* @deprecated Use {@link #RequestEntity(Object, HttpHeaders, HttpMethod, URI)}
* @deprecated in favor of {@link #RequestEntity(Object, HttpHeaders, HttpMethod, URI)}
*/
@Deprecated
public RequestEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers,
@Deprecated(since = "7.0", forRemoval = true)
public RequestEntity(
@Nullable T body, @Nullable MultiValueMap<String, String> headers,
@Nullable HttpMethod method, URI url) {
this(body, headers, method, url, null);
@@ -182,9 +183,10 @@ public class RequestEntity<T> extends HttpEntity<T> {
* @param url the URL
* @param type the type used for generic type resolution
* @since 4.3
* @deprecated Use {@link #RequestEntity(Object, HttpHeaders, HttpMethod, URI, Type)}
* @deprecated in favor of {@link #RequestEntity(Object, HttpHeaders, HttpMethod, URI, Type)}
*/
@Deprecated
@SuppressWarnings("removal")
@Deprecated(since = "7.0", forRemoval = true)
public RequestEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers,
@Nullable HttpMethod method, @Nullable URI url, @Nullable Type type) {

View File

@@ -139,9 +139,9 @@ public class ResponseEntity<T> extends HttpEntity<T> {
* Create a {@code ResponseEntity} with headers and a status code.
* @param headers the entity headers
* @param status the status code
* @deprecated Use {@link #ResponseEntity(HttpHeaders, HttpStatusCode)}
* @deprecated in favor of {@link #ResponseEntity(HttpHeaders, HttpStatusCode)}
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public ResponseEntity(MultiValueMap<String, String> headers, HttpStatusCode status) {
this(null, headers, status);
}
@@ -152,9 +152,9 @@ public class ResponseEntity<T> extends HttpEntity<T> {
* @param headers the entity headers
* @param rawStatus the status code value
* @since 5.3.2
* @deprecated Use {@link #ResponseEntity(Object, HttpHeaders, int)}
* @deprecated in favor of {@link #ResponseEntity(Object, HttpHeaders, int)}
*/
@Deprecated
@Deprecated(since = "7.0", forRemoval = true)
public ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, int rawStatus) {
this(body, headers, HttpStatusCode.valueOf(rawStatus));
}
@@ -164,9 +164,10 @@ public class ResponseEntity<T> extends HttpEntity<T> {
* @param body the entity body
* @param headers the entity headers
* @param statusCode the status code
* @deprecated Use {@link #ResponseEntity(Object, HttpHeaders, HttpStatusCode)}
* @deprecated in favor of {@link #ResponseEntity(Object, HttpHeaders, HttpStatusCode)}
*/
@Deprecated
@SuppressWarnings("removal")
@Deprecated(since = "7.0", forRemoval = true)
public ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, HttpStatusCode statusCode) {
super(body, headers);
Assert.notNull(statusCode, "HttpStatusCode must not be null");

View File

@@ -93,7 +93,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
* {@link #setUrlPathHelper(UrlPathHelper)}, if at all. For further details,
* please see {@link #setAllowInitLookupPath(boolean)}.
*/
@Deprecated
@Deprecated(since = "5.3", forRemoval = true)
public void setAlwaysUseFullPath(boolean alwaysUseFullPath) {
initUrlPathHelper();
this.urlPathHelper.setAlwaysUseFullPath(alwaysUseFullPath);
@@ -107,7 +107,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
* {@link #setUrlPathHelper(UrlPathHelper)}, if at all. For further details,
* please see {@link #setAllowInitLookupPath(boolean)}.
*/
@Deprecated
@Deprecated(since = "5.3", forRemoval = true)
public void setUrlDecode(boolean urlDecode) {
initUrlPathHelper();
this.urlPathHelper.setUrlDecode(urlDecode);
@@ -121,7 +121,7 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
* {@link #setUrlPathHelper(UrlPathHelper)}, if at all. For further details,
* please see {@link #setAllowInitLookupPath(boolean)}.
*/
@Deprecated
@Deprecated(since = "5.3", forRemoval = true)
public void setRemoveSemicolonContent(boolean removeSemicolonContent) {
initUrlPathHelper();
this.urlPathHelper.setRemoveSemicolonContent(removeSemicolonContent);