Closed
Description
Consider the following code in which a package is annotated with @NonNullApi
:
package-info.java
@NonNullApi
package foo;
import org.springframework.lang.NonNullApi;
Reproducer
package foo;
import javax.annotation.Nonnull;
import org.junit.Test;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.lang.NonNullApi;
import static org.junit.Assert.*;
public class ReproducerTest {
@Test
public void shouldFindMetaAnnotation() {
NonNullApi annotation = getClass().getPackage().getAnnotation(NonNullApi.class);
assertTrue(AnnotationUtils.isAnnotationMetaPresent(annotation, javax.annotation.Nonnull.class));
}
}
Using AnnotationUtils.isAnnotationMetaPresent(…)
for annotation discovery fails to report that NonNullApi
is a meta-annotation for javax.annotation.Nonnull
.
Spring Data uses JSR 305-based nullability inference for repository method arguments and return value inspection