From eb9ee9fafadc192bda8e329f55aaaec36a0041af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Basl=C3=A9?= Date: Fri, 27 Dec 2024 11:56:22 +0100 Subject: [PATCH] Polishing `@since` missing tags in some methods related to the HttpHeaders change --- .../org/springframework/test/http/HttpHeadersAssert.java | 4 ++++ .../main/java/org/springframework/http/HttpHeaders.java | 8 +++++++- .../RequestHeaderMapMethodArgumentResolver.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/http/HttpHeadersAssert.java b/spring-test/src/main/java/org/springframework/test/http/HttpHeadersAssert.java index d0c265330014..c471f881e5cf 100644 --- a/spring-test/src/main/java/org/springframework/test/http/HttpHeadersAssert.java +++ b/spring-test/src/main/java/org/springframework/test/http/HttpHeadersAssert.java @@ -91,6 +91,7 @@ public HttpHeadersAssert containsHeaders(String... names) { * Verify that the actual HTTP headers contain only the headers with the * given {@code names}, in any order and in a case-insensitive manner. * @param names the names of expected HTTP headers + * @since 7.0 */ public HttpHeadersAssert containsOnlyHeaders(String... names) { this.namesAssert @@ -170,6 +171,7 @@ public HttpHeadersAssert hasValue(String name, Instant value) { * the given list of values, and in the same order. * @param name the considered header name (case-insensitive) * @param values the exhaustive list of expected values + * @since 7.0 */ public HttpHeadersAssert hasExactlyValues(String name, List values) { containsHeader(name); @@ -184,6 +186,7 @@ public HttpHeadersAssert hasExactlyValues(String name, List values) { * the given list of values, in any order. * @param name the considered header name (case-insensitive) * @param values the exhaustive list of expected values + * @since 7.0 */ public HttpHeadersAssert hasExactlyValuesInAnyOrder(String name, List values) { containsHeader(name); @@ -296,6 +299,7 @@ public HttpHeadersAssert hasSizeBetween(int lowerBoundary, int higherBoundary) { * Verify that the number actual headers is the same as in the given * {@code HttpHeaders}. * @param other the {@code HttpHeaders} to compare size with + * @since 7.0 */ public HttpHeadersAssert hasSameSizeAs(HttpHeaders other) { this.namesAssert diff --git a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java index 4c68a7e1daaf..9386b760dea7 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java +++ b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java @@ -496,7 +496,7 @@ public HttpHeaders(HttpHeaders httpHeaders) { * Get the list of header values for the given header name, if any. * @param headerName the header name * @return the list of header values, or an empty list - * @since 5.2 + * @since 7.0 */ public List getOrEmpty(String headerName) { return getOrDefault(headerName, Collections.emptyList()); @@ -508,6 +508,7 @@ public List getOrEmpty(String headerName) { * @param headerName the header name * @param defaultValue the fallback list if header is not present * @return the list of header values, or a default list of values + * @since 7.0 */ public List getOrDefault(String headerName, List defaultValue) { List values = get(headerName); @@ -1796,6 +1797,7 @@ public void addAll(String headerName, List headerValues) { * values of each individual header name instead. * @param headers the headers to add * @see #putAll(HttpHeaders) + * @since 7.0 */ public void addAll(HttpHeaders headers) { this.headers.addAll(headers.headers); @@ -1866,6 +1868,7 @@ public Map asSingleValueMap() { * @deprecated This method is provided for backward compatibility with APIs * that would only accept maps. Generally avoid using HttpHeaders as a Map * or MultiValueMap. + * @since 7.0 */ @Deprecated public MultiValueMap asMultiValueMap() { @@ -1920,6 +1923,7 @@ public boolean containsHeaderValue(String headerName, String value) { /** * Get the list of values associated with the given header name. * @param headerName the header name + * @since 7.0 */ @Nullable public List get(String headerName) { @@ -1953,6 +1957,7 @@ public List get(String headerName) { * Put all the entries from the given HttpHeaders into this HttpHeaders. * @param headers the given headers * @see #put(String, List) + * @since 7.0 */ public void putAll(HttpHeaders headers) { this.headers.putAll(headers.headers); @@ -1973,6 +1978,7 @@ public void putAll(Map> headers) { * value list or {@code null} if that header wasn't present. * @param key the name of the header to remove * @return the value list associated with the removed header name + * @since 7.0 */ public @Nullable List remove(String key) { return this.headers.remove(key); diff --git a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolver.java b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolver.java index 5ba3e1f2073f..22f46592e49a 100644 --- a/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolver.java +++ b/spring-web/src/main/java/org/springframework/web/method/annotation/RequestHeaderMapMethodArgumentResolver.java @@ -85,7 +85,7 @@ else if (MultiValueMap.class.isAssignableFrom(paramType)) { } } - void copyHeaderValues(NativeWebRequest webRequest, BiConsumer consumer) { + private void copyHeaderValues(NativeWebRequest webRequest, BiConsumer consumer) { for (Iterator iterator = webRequest.getHeaderNames(); iterator.hasNext();) { String headerName = iterator.next(); String[] headerValues = webRequest.getHeaderValues(headerName);