mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Avoid compilation error on WebTestClient without Hamcrest
This commit removes JSpecify (TYPE_USE) annotations on org.hamcrest.Matcher parameters to prevent a related "Cannot attach type annotations" error when Hamcrest (optional dependency) is not in the classpath with Java > 22. Closes gh-35666
This commit is contained in:
+6
-2
@@ -26,6 +26,8 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.hamcrest.Matcher;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.NullUnmarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
@@ -956,14 +958,16 @@ public interface WebTestClient {
|
||||
* Assert the extracted body with a {@link Matcher}.
|
||||
* @since 5.1
|
||||
*/
|
||||
<T extends S> T value(Matcher<? super @Nullable B> matcher);
|
||||
@NullUnmarked // To avoid a "Cannot attach type annotations" error when org.hamcrest.Matcher is not in the classpath
|
||||
<T extends S> T value(Matcher<? super B> matcher);
|
||||
|
||||
/**
|
||||
* Transform the extracted the body with a function, for example, extracting a
|
||||
* property, and assert the mapped value with a {@link Matcher}.
|
||||
* @since 5.1
|
||||
*/
|
||||
<T extends S, R> T value(Function<@Nullable B, @Nullable R> bodyMapper, Matcher<? super @Nullable R> matcher);
|
||||
@NullUnmarked // To avoid a "Cannot attach type annotations" error when org.hamcrest.Matcher is not in the classpath
|
||||
<T extends S, R> T value(@NonNull Function<@Nullable B, @Nullable R> bodyMapper, Matcher<? super R> matcher);
|
||||
|
||||
/**
|
||||
* Assert the extracted body with a {@link Consumer}.
|
||||
|
||||
Reference in New Issue
Block a user