You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Package tangle in org.springframework.core [SPR-13153] #17744
Commit 518c85b introduced a package tangle resulting from MethodParameter's new dependency on AnnotationUtils.
Analysis
MethodParameter now uses AnnotationUtils in order to support annotation attribute aliases via @AliasFor. Without this functionality, many of the aliases for value attributes cannot be supported in annotations on methods and method parameters. For example, the following (amongst others) rely on this support:
However, AnnotationUtils already has a dependency on BridgeMethodResolver which resides in the core package alongside MethodParameter, and this causes the package cycle.
Proposals
Refactor MethodParameter to use reflection to invoke utility methods in AnnotationUtils.
Refactor AnnotationUtils to use reflection to invoke utility methods in BridgeMethodResolver.
Introduce subclass of MethodParameter in package org.springframework.core.annotation with support for synthesizing annotations.
Alright, the SynthesizingMethodParameter approach is coming to master now... selectively used for web and message handler methods at this point, with other areas such as qualifier matching still using the basic MethodParameter class with raw annotation exposure.
FYI: for anyone else following this issue, I'd just like to point out that attempting to synthesize an annotation is exactly that, an attempt.
If an annotation is not synthesizable (i.e., does not make use of @AliasFor) then Spring simply does not synthesize it. In other words, if you directly invoke one of the synthesizeAnnotation*(..) methods in AnnotationUtils (or indirectly via SynthesizingMethodParameter or AnnotatedElementUtils), Spring will only synthesize the annotation if it's necessary; otherwise, Spring simply returns the original (raw) annotation as is.
Activity
spring-projects-issues commentedon Jun 29, 2015
Juergen Hoeller commented
Alright, the
SynthesizingMethodParameterapproach is coming to master now... selectively used for web and message handler methods at this point, with other areas such as qualifier matching still using the basicMethodParameterclass with raw annotation exposure.Juergen
spring-projects-issues commentedon Jun 30, 2015
Sam Brannen commented
Thanks for implementing the
SynthesizingMethodParameterapproach!That turned out to be quite an elegant solution to the problem.
spring-projects-issues commentedon Jun 30, 2015
Sam Brannen commented
FYI: for anyone else following this issue, I'd just like to point out that attempting to synthesize an annotation is exactly that, an attempt.
If an annotation is not synthesizable (i.e., does not make use of
@AliasFor) then Spring simply does not synthesize it. In other words, if you directly invoke one of thesynthesizeAnnotation*(..)methods inAnnotationUtils(or indirectly viaSynthesizingMethodParameterorAnnotatedElementUtils), Spring will only synthesize the annotation if it's necessary; otherwise, Spring simply returns the original (raw) annotation as is.Regards,
Sam