Skip to content

AnnotationMetadataReadingVisitor.getMetaAnnotationTypes(String) may return null but it is not marked @Nullable [SPR-17046] #21584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jul 16, 2018 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 16, 2018

Andy Wilkinson opened SPR-17046 and commented

I've noticed that AnnotationMetadataReadingVisitor.getMetaAnnotationTypes(String) will return null rather than the documented empty Set in two scenarios:

  1. getMetaAnnotationTypes is called with the name of an annotation that is not present
  2. getMetaAnnotationTypes is called with the name of an annotation that is present but that is not on the classpath

I've attached a small sample that hopefully illustrates both. It tests with Framework 5.1 snapshots but I believe that 5.0 is also affected and perhaps 4.3.x too.


Affects: 5.0.7

Attachments:

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Indeed, getMetaAnnotationTypes is not meant to ever return null... StandardAnnotationMetadata adheres to that, so AnnotationMetadataReadingVisitor simply returns an empty Set in those cases as well now.

I'll backport this to 5.0.8 but intend to leave 4.3.x as-is unless there is an immediate issue with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants