Skip to content
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

Support meta-annotation attribute overrides in ASM-based annotation processing [SPR-11574] #16198

Closed
1 task done
spring-projects-issues opened this issue Mar 18, 2014 · 2 comments
Assignees
Labels
in: core type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Mar 18, 2014

Sam Brannen opened SPR-11574 and commented

Status Quo

Recent releases of the Spring Framework have introduced support for meta-annotation attribute overrides in custom composed annotations. This support works as expected with reflection-based annotation processing; however, Spring's ASM-based support for annotation processing completely ignores meta-annotation attribute overrides.


Analysis

By comparing the implementations of getAnnotationAttributes(String, boolean) in StandardAnnotationMetadata (reflection) and AnnotationMetadataReadingVisitor (ASM), we see that StandardAnnotationMetadata delegates to AnnotatedElementUtils which properly supports meta-annotation attribute overrides. Whereas, AnnotationMetadataReadingVisitor performs a simple look-up in a local (linked) hash map with complete disregard for attribute overrides.


Deliverables

  1. Refactor AnnotationMetadataReadingVisitor so that Spring's ASM-based annotation processing supports meta-annotation attribute overrides on par with the support already provided for reflection-based processing in AnnotatedElementUtils.
    • See TODO comments in ConfigurationClassPostProcessorTests.

Affects: 4.0 GA

Issue Links:

  • #16181 Support Class meta-annotation attributes with ASM-based annotation processing ("depends on")
  • #17234 AnnotationTypeFilter not finding java.lang annotations as meta annotations
  • #16272 AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() overrides values it should not
  • #16332 AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() mutates the map argument
  • #16331 Consider not overriding meta-annotation attributes if empty
@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 18, 2014

Sam Brannen commented

This issue depends on #16181.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Mar 19, 2014

Sam Brannen commented

Fixed as described in the comments for GitHub commit 99cd2f6:

Support meta-annotation overrides in ASM processing

Prior to this commit, Spring supported meta-annotation attribute
overrides in custom composed annotations with reflection-based
annotation processing but not with ASM-based annotation processing.

This commit ensures that meta-annotation attribute overrides are
supported in AnnotationMetadataReadingVisitor.getAnnotationAttributes().

Specifically, the above commit introduced AnnotationReadingVisitorUtils.getMergedAnnotationAttributes() which is responsible for merging annotation attributes within the annotation hierarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: bug
Projects
None yet
Development

No branches or pull requests

2 participants