Remove APIs deprecated for removal in 6.1

This is the first commit that removes deprecated APIs.

Subsequent commits will remove additional deprecated APIs.

See gh-29449
This commit is contained in:
Sam Brannen
2023-04-19 17:23:49 +02:00
parent d446de62a4
commit 7df2e2a8d2
13 changed files with 58 additions and 508 deletions

View File

@@ -1,61 +0,0 @@
/*
* Copyright 2002-2023 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.core.task.support;
import java.util.concurrent.Executor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.util.Assert;
/**
* Adapter that exposes the {@link java.util.concurrent.Executor} interface for
* any Spring {@link org.springframework.core.task.TaskExecutor}.
*
* <p>This adapter is less useful since Spring 3.0, since TaskExecutor itself
* extends the {@code Executor} interface. The adapter is only relevant for
* <em>hiding</em> the {@code TaskExecutor} nature of a given object, solely
* exposing the standard {@code Executor} interface to a client.
*
* @author Juergen Hoeller
* @since 2.5
* @see java.util.concurrent.Executor
* @see org.springframework.core.task.TaskExecutor
* @deprecated {@code ConcurrentExecutorAdapter} is obsolete and will be removed
* in Spring Framework 6.1
*/
@Deprecated(since = "6.0.5", forRemoval = true)
public class ConcurrentExecutorAdapter implements Executor {
private final TaskExecutor taskExecutor;
/**
* Create a new ConcurrentExecutorAdapter for the given Spring TaskExecutor.
* @param taskExecutor the Spring TaskExecutor to wrap
*/
public ConcurrentExecutorAdapter(TaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "TaskExecutor must not be null");
this.taskExecutor = taskExecutor;
}
@Override
public void execute(Runnable command) {
this.taskExecutor.execute(command);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@@ -98,17 +98,6 @@ public abstract class Assert {
}
}
/**
* Assert a boolean expression, throwing an {@code IllegalStateException}
* if the expression evaluates to {@code false}.
* @deprecated as of 4.3.7, in favor of {@link #state(boolean, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void state(boolean expression) {
state(expression, "[Assertion failed] - this state invariant must be true");
}
/**
* Assert a boolean expression, throwing an {@code IllegalArgumentException}
* if the expression evaluates to {@code false}.
@@ -141,17 +130,6 @@ public abstract class Assert {
}
}
/**
* Assert a boolean expression, throwing an {@code IllegalArgumentException}
* if the expression evaluates to {@code false}.
* @deprecated as of 4.3.7, in favor of {@link #isTrue(boolean, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void isTrue(boolean expression) {
isTrue(expression, "[Assertion failed] - this expression must be true");
}
/**
* Assert that an object is {@code null}.
* <pre class="code">Assert.isNull(value, "The value must be null");</pre>
@@ -182,16 +160,6 @@ public abstract class Assert {
}
}
/**
* Assert that an object is {@code null}.
* @deprecated as of 4.3.7, in favor of {@link #isNull(Object, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void isNull(@Nullable Object object) {
isNull(object, "[Assertion failed] - the object argument must be null");
}
/**
* Assert that an object is not {@code null}.
* <pre class="code">Assert.notNull(clazz, "The class must not be null");</pre>
@@ -223,16 +191,6 @@ public abstract class Assert {
}
}
/**
* Assert that an object is not {@code null}.
* @deprecated as of 4.3.7, in favor of {@link #notNull(Object, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void notNull(@Nullable Object object) {
notNull(object, "[Assertion failed] - this argument is required; it must not be null");
}
/**
* Assert that the given String is not empty; that is,
* it must not be {@code null} and not the empty String.
@@ -268,18 +226,6 @@ public abstract class Assert {
}
}
/**
* Assert that the given String is not empty; that is,
* it must not be {@code null} and not the empty String.
* @deprecated as of 4.3.7, in favor of {@link #hasLength(String, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void hasLength(@Nullable String text) {
hasLength(text,
"[Assertion failed] - this String argument must have length; it must not be null or empty");
}
/**
* Assert that the given String contains valid text content; that is, it must not
* be {@code null} and must contain at least one non-whitespace character.
@@ -315,18 +261,6 @@ public abstract class Assert {
}
}
/**
* Assert that the given String contains valid text content; that is, it must not
* be {@code null} and must contain at least one non-whitespace character.
* @deprecated as of 4.3.7, in favor of {@link #hasText(String, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void hasText(@Nullable String text) {
hasText(text,
"[Assertion failed] - this String argument must have text; it must not be null, empty, or blank");
}
/**
* Assert that the given text does not contain the given substring.
* <pre class="code">Assert.doesNotContain(name, "rod", "Name must not contain 'rod'");</pre>
@@ -361,17 +295,6 @@ public abstract class Assert {
}
}
/**
* Assert that the given text does not contain the given substring.
* @deprecated as of 4.3.7, in favor of {@link #doesNotContain(String, String, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void doesNotContain(@Nullable String textToSearch, String substring) {
doesNotContain(textToSearch, substring,
() -> "[Assertion failed] - this String argument must not contain the substring [" + substring + "]");
}
/**
* Assert that an array contains elements; that is, it must not be
* {@code null} and must contain at least one element.
@@ -404,17 +327,6 @@ public abstract class Assert {
}
}
/**
* Assert that an array contains elements; that is, it must not be
* {@code null} and must contain at least one element.
* @deprecated as of 4.3.7, in favor of {@link #notEmpty(Object[], String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void notEmpty(@Nullable Object[] array) {
notEmpty(array, "[Assertion failed] - this array must not be empty: it must contain at least 1 element");
}
/**
* Assert that an array contains no {@code null} elements.
* <p>Note: Does not complain if the array is empty!
@@ -455,16 +367,6 @@ public abstract class Assert {
}
}
/**
* Assert that an array contains no {@code null} elements.
* @deprecated as of 4.3.7, in favor of {@link #noNullElements(Object[], String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void noNullElements(@Nullable Object[] array) {
noNullElements(array, "[Assertion failed] - this array must not contain any null elements");
}
/**
* Assert that a collection contains elements; that is, it must not be
* {@code null} and must contain at least one element.
@@ -499,18 +401,6 @@ public abstract class Assert {
}
}
/**
* Assert that a collection contains elements; that is, it must not be
* {@code null} and must contain at least one element.
* @deprecated as of 4.3.7, in favor of {@link #notEmpty(Collection, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void notEmpty(@Nullable Collection<?> collection) {
notEmpty(collection,
"[Assertion failed] - this collection must not be empty: it must contain at least 1 element");
}
/**
* Assert that a collection contains no {@code null} elements.
* <p>Note: Does not complain if the collection is empty!
@@ -584,17 +474,6 @@ public abstract class Assert {
}
}
/**
* Assert that a Map contains entries; that is, it must not be {@code null}
* and must contain at least one entry.
* @deprecated as of 4.3.7, in favor of {@link #notEmpty(Map, String)};
* to be removed in 6.1
*/
@Deprecated(forRemoval = true)
public static void notEmpty(@Nullable Map<?, ?> map) {
notEmpty(map, "[Assertion failed] - this map must not be empty; it must contain at least one entry");
}
/**
* Assert that the provided object is an instance of the provided class.
* <pre class="code">Assert.instanceOf(Foo.class, foo, "Foo expected");</pre>