From 887ef75700efdecba850e5e4f141c83473638f18 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 19 Aug 2025 17:30:47 +0200 Subject: [PATCH] =?UTF-8?q?Remove=20redundant=20declarations=20of=20JSpeci?= =?UTF-8?q?fy's=20@=E2=81=A0NonNull=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes gh-35341 --- .../beans/ExtendedBeanInfoFactory.java | 4 +--- .../core/annotation/TypeMappedAnnotations.java | 3 +-- .../core/annotation/AnnotationsScannerTests.java | 13 ++++++------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java index 8532d26e40e..2a80f47584a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/ExtendedBeanInfoFactory.java @@ -20,8 +20,6 @@ import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.lang.reflect.Method; -import org.jspecify.annotations.NonNull; - import org.springframework.core.Ordered; /** @@ -44,7 +42,7 @@ import org.springframework.core.Ordered; public class ExtendedBeanInfoFactory extends StandardBeanInfoFactory { @Override - public @NonNull BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException { + public BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException { BeanInfo beanInfo = super.getBeanInfo(beanClass); return (supports(beanClass) ? new ExtendedBeanInfo(beanInfo) : beanInfo); } diff --git a/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotations.java b/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotations.java index 310348a5cf8..2c20d6766b0 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotations.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/TypeMappedAnnotations.java @@ -29,7 +29,6 @@ import java.util.function.Predicate; import java.util.stream.Stream; import java.util.stream.StreamSupport; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; /** @@ -483,7 +482,7 @@ final class TypeMappedAnnotations implements MergedAnnotations { } @Override - public @NonNull List finish(@Nullable List processResult) { + public List finish(@Nullable List processResult) { return this.aggregates; } } diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java index 6cb5c2b2248..c1f06239b78 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationsScannerTests.java @@ -29,7 +29,6 @@ import java.util.Objects; import java.util.function.Predicate; import java.util.stream.Stream; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; @@ -470,13 +469,13 @@ class AnnotationsScannerTests { new AnnotationsProcessor() { @Override - public @NonNull String doWithAggregate(Object context, int aggregateIndex) { + public String doWithAggregate(Object context, int aggregateIndex) { return ""; } @Override - public @NonNull String doWithAnnotations(Object context, int aggregateIndex, - @Nullable Object source, @Nullable Annotation @Nullable [] annotations) { + public String doWithAnnotations(Object context, int aggregateIndex, + @Nullable Object source, @Nullable Annotation[] annotations) { throw new IllegalStateException("Should not call"); } @@ -502,13 +501,13 @@ class AnnotationsScannerTests { new AnnotationsProcessor() { @Override - public @NonNull String doWithAnnotations(Object context, int aggregateIndex, - @Nullable Object source, @Nullable Annotation @Nullable [] annotations) { + public String doWithAnnotations(Object context, int aggregateIndex, + @Nullable Object source, @Nullable Annotation[] annotations) { return "K"; } @Override - public @NonNull String finish(@Nullable String result) { + public String finish(@Nullable String result) { return "O" + result; }