Skip to content

Commit

Permalink
Polishing deprecated methods
Browse files Browse the repository at this point in the history
Added since and forRemoval to Deprecated methods.
  • Loading branch information
poutsma committed Nov 16, 2022
1 parent 37b4391 commit 9be6cea
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ private static Map<String, String> addCharsetParameter(Charset charset, Map<Stri
* @param <T> 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<T extends MimeType> implements Comparator<T> {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MimeType> SPECIFICITY_COMPARATOR = new MimeType.SpecificityComparator<>();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void trimAllWhitespace() {
}

@Test
@Deprecated
@SuppressWarnings("deprecation")
void trimLeadingWhitespace() {
assertThat(StringUtils.trimLeadingWhitespace(null)).isNull();
assertThat(StringUtils.trimLeadingWhitespace("")).isEqualTo("");
Expand All @@ -114,7 +114,7 @@ void trimLeadingWhitespace() {
}

@Test
@Deprecated
@SuppressWarnings("deprecation")
void trimTrailingWhitespace() {
assertThat(StringUtils.trimTrailingWhitespace(null)).isNull();
assertThat(StringUtils.trimTrailingWhitespace("")).isEqualTo("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public static String toString(Collection<MediaType> 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<MediaType> mediaTypes) {
Assert.notNull(mediaTypes, "'mediaTypes' must not be null");
if (mediaTypes.size() > 1) {
Expand Down Expand Up @@ -865,7 +865,7 @@ public static void sortBySpecificity(List<MediaType> 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<MediaType> mediaTypes) {
Assert.notNull(mediaTypes, "'mediaTypes' must not be null");
if (mediaTypes.size() > 1) {
Expand All @@ -891,7 +891,7 @@ public static void sortBySpecificityAndQuality(List<MediaType> 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<MediaType> QUALITY_VALUE_COMPARATOR = (mediaType1, mediaType2) -> {
double quality1 = mediaType1.getQualityValue();
double quality2 = mediaType2.getQualityValue();
Expand Down Expand Up @@ -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<MediaType> SPECIFICITY_COMPARATOR = new SpecificityComparator<>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void specificityComparator() throws Exception {
MediaType allXml = new MediaType("application", "*+xml");
MediaType all = MediaType.ALL;

@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
Comparator<MediaType> comp = MediaType.SPECIFICITY_COMPARATOR;

// equal
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -398,7 +398,7 @@ public void qualityComparator() throws Exception {
MediaType allXml = new MediaType("application", "*+xml");
MediaType all = MediaType.ALL;

@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
Comparator<MediaType> comp = MediaType.QUALITY_VALUE_COMPARATOR;

// equal
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 9be6cea

Please sign in to comment.