diff --git a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java index efce947cb7f1..7d502e4459e9 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java +++ b/spring-context/src/main/java/org/springframework/scheduling/support/CronSequenceGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 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. @@ -55,7 +55,7 @@ * @see CronTrigger * @deprecated as of 5.3, in favor of {@link CronExpression} */ -@Deprecated +@Deprecated(since = "5.3", forRemoval = true) public class CronSequenceGenerator { private final String expression; @@ -84,7 +84,7 @@ public class CronSequenceGenerator { * @see java.util.TimeZone#getDefault() * @deprecated as of 5.3, in favor of {@link CronExpression#parse(String)} */ - @Deprecated + @Deprecated(since = "5.3", forRemoval = true) public CronSequenceGenerator(String expression) { this(expression, TimeZone.getDefault()); } diff --git a/spring-core/src/main/java/org/springframework/util/MimeType.java b/spring-core/src/main/java/org/springframework/util/MimeType.java index 7fe9a46e9ff2..a1464d82217e 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeType.java +++ b/spring-core/src/main/java/org/springframework/util/MimeType.java @@ -708,7 +708,7 @@ private static Map addCharsetParameter(Charset charset, Map the type of mime types that may be compared by this comparator * @deprecated As of 6.0, with no direct replacement */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) public static class SpecificityComparator implements Comparator { @Override diff --git a/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java b/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java index 0a76878a82f0..b15948a6a4b3 100644 --- a/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java +++ b/spring-core/src/main/java/org/springframework/util/MimeTypeUtils.java @@ -55,7 +55,8 @@ public abstract class MimeTypeUtils { * Comparator formally used by {@link #sortBySpecificity(List)}. * @deprecated As of 6.0, with no direct replacement */ - @Deprecated(since = "6.0") + @SuppressWarnings("removal") + @Deprecated(since = "6.0", forRemoval = true) public static final Comparator SPECIFICITY_COMPARATOR = new MimeType.SpecificityComparator<>(); /** diff --git a/spring-core/src/main/java/org/springframework/util/StringUtils.java b/spring-core/src/main/java/org/springframework/util/StringUtils.java index 3c2716be5ade..f2eb26323414 100644 --- a/spring-core/src/main/java/org/springframework/util/StringUtils.java +++ b/spring-core/src/main/java/org/springframework/util/StringUtils.java @@ -221,9 +221,9 @@ public static boolean containsWhitespace(@Nullable String str) { * @param str the {@code String} to check * @return the trimmed {@code String} * @see java.lang.Character#isWhitespace - * @deprecated in favor of {@link String#strip()} + * @deprecated since 6.0, in favor of {@link String#strip()} */ - @Deprecated + @Deprecated(since = "6.0") public static String trimWhitespace(String str) { if (!hasLength(str)) { return str; @@ -277,9 +277,9 @@ public static String trimAllWhitespace(String str) { * @param str the {@code String} to check * @return the trimmed {@code String} * @see java.lang.Character#isWhitespace - * @deprecated in favor of {@link String#stripLeading()} + * @deprecated since 6.0, in favor of {@link String#stripLeading()} */ - @Deprecated + @Deprecated(since = "6.0") public static String trimLeadingWhitespace(String str) { if (!hasLength(str)) { return str; @@ -293,9 +293,9 @@ public static String trimLeadingWhitespace(String str) { * @param str the {@code String} to check * @return the trimmed {@code String} * @see java.lang.Character#isWhitespace - * @deprecated in favor of {@link String#stripTrailing()} + * @deprecated since 6.0, in favor of {@link String#stripTrailing()} */ - @Deprecated + @Deprecated(since = "6.0") public static String trimTrailingWhitespace(String str) { if (!hasLength(str)) { return str; diff --git a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java index dbf110874102..783383ec2a86 100644 --- a/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/StringUtilsTests.java @@ -98,7 +98,7 @@ void trimAllWhitespace() { } @Test - @Deprecated + @SuppressWarnings("deprecation") void trimLeadingWhitespace() { assertThat(StringUtils.trimLeadingWhitespace(null)).isNull(); assertThat(StringUtils.trimLeadingWhitespace("")).isEqualTo(""); @@ -114,7 +114,7 @@ void trimLeadingWhitespace() { } @Test - @Deprecated + @SuppressWarnings("deprecation") void trimTrailingWhitespace() { assertThat(StringUtils.trimTrailingWhitespace(null)).isNull(); assertThat(StringUtils.trimTrailingWhitespace("")).isEqualTo(""); diff --git a/spring-web/src/main/java/org/springframework/http/MediaType.java b/spring-web/src/main/java/org/springframework/http/MediaType.java index 71add2323e90..d290e506de9c 100644 --- a/spring-web/src/main/java/org/springframework/http/MediaType.java +++ b/spring-web/src/main/java/org/springframework/http/MediaType.java @@ -836,7 +836,7 @@ public static String toString(Collection mediaTypes) { * @param mediaTypes the list of media types to be sorted * @deprecated As of 6.0, in favor of {@link MimeTypeUtils#sortBySpecificity(List)} */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) public static void sortBySpecificity(List mediaTypes) { Assert.notNull(mediaTypes, "'mediaTypes' must not be null"); if (mediaTypes.size() > 1) { @@ -865,7 +865,7 @@ public static void sortBySpecificity(List mediaTypes) { * @see #getQualityValue() * @deprecated As of 6.0, with no direct replacement */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) public static void sortByQualityValue(List mediaTypes) { Assert.notNull(mediaTypes, "'mediaTypes' must not be null"); if (mediaTypes.size() > 1) { @@ -891,7 +891,7 @@ public static void sortBySpecificityAndQuality(List mediaTypes) { * Comparator used by {@link #sortByQualityValue(List)}. * @deprecated As of 6.0, with no direct replacement */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) public static final Comparator QUALITY_VALUE_COMPARATOR = (mediaType1, mediaType2) -> { double quality1 = mediaType1.getQualityValue(); double quality2 = mediaType2.getQualityValue(); @@ -931,7 +931,8 @@ else if (!mediaType1.getSubtype().equals(mediaType2.getSubtype())) { // audio/b * Comparator used by {@link #sortBySpecificity(List)}. * @deprecated As of 6.0, with no direct replacement */ - @Deprecated(since = "6.0") + @Deprecated(since = "6.0", forRemoval = true) + @SuppressWarnings("removal") public static final Comparator SPECIFICITY_COMPARATOR = new SpecificityComparator<>() { @Override diff --git a/spring-web/src/test/java/org/springframework/http/MediaTypeTests.java b/spring-web/src/test/java/org/springframework/http/MediaTypeTests.java index 190bdf82e890..a3661ff719c5 100644 --- a/spring-web/src/test/java/org/springframework/http/MediaTypeTests.java +++ b/spring-web/src/test/java/org/springframework/http/MediaTypeTests.java @@ -291,7 +291,7 @@ public void specificityComparator() throws Exception { MediaType allXml = new MediaType("application", "*+xml"); MediaType all = MediaType.ALL; - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") Comparator comp = MediaType.SPECIFICITY_COMPARATOR; // equal @@ -335,7 +335,7 @@ public void specificityComparator() throws Exception { } @Test - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") public void sortBySpecificityRelated() { MediaType audioBasic = new MediaType("audio", "basic"); MediaType audio = new MediaType("audio"); @@ -366,7 +366,7 @@ public void sortBySpecificityRelated() { } @Test - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") public void sortBySpecificityUnrelated() { MediaType audioBasic = new MediaType("audio", "basic"); MediaType audioWave = new MediaType("audio", "wave"); @@ -398,7 +398,7 @@ public void qualityComparator() throws Exception { MediaType allXml = new MediaType("application", "*+xml"); MediaType all = MediaType.ALL; - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") Comparator comp = MediaType.QUALITY_VALUE_COMPARATOR; // equal @@ -442,7 +442,7 @@ public void qualityComparator() throws Exception { } @Test - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") public void sortByQualityRelated() { MediaType audioBasic = new MediaType("audio", "basic"); MediaType audio = new MediaType("audio"); @@ -473,7 +473,7 @@ public void sortByQualityRelated() { } @Test - @SuppressWarnings("deprecation") + @SuppressWarnings("removal") public void sortByQualityUnrelated() { MediaType audioBasic = new MediaType("audio", "basic"); MediaType audioWave = new MediaType("audio", "wave");