Skip to content

AnnotationUtils.isAnnotationMetaPresent(…) no longer considers javax.annotation.Nonnull #22685

Closed
@mp911de

Description

@mp911de

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions