-
Notifications
You must be signed in to change notification settings - Fork 38.1k
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
Expose MergedAnnotations from meta-data classes #22884
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Comments
This was referenced May 4, 2019
jhoeller
added
the
in: core
Issues in core modules (aop, beans, core, context, expression)
label
May 4, 2019
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Update TypeMappedAnnotation so that Strings can be used to represent Class attribute values. This will allow ASM annotation readers to present a `MergedAnnotation` instance without necessarily having the actual class values on the classpath. When the underlying value is a String, any calls to `getValue(name, String.class)` or `asMap(Adapt.CLASS_TO_STRING)` will simply return the original String. Calls that need the actual Class result (such as `getClass`) will use `Class.forName` and may throw a `ClassNotFoundException` at that point. This commit also allows an empty Object[] to be used to represent any empty primitive array. See spring-projectsgh-22884
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Add a factory method to `MergedAnnotation` that allows an instance to be created for an explicit collection of root annotations. This method will allow ASM based readers to expose a `MergedAnnotation` instance that has root annotations loaded from bytecode, and meta-annotations loaded using reflection. See spring-projectsgh-22884
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Add some additional tests to provide more coverage of class and method meta-data support. See spring-projectsgh-22884
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Extract and pull-up some common method implementations and make them default methods of the interface. See spring-projectsgh-22884
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Add `AnnotatedTypeMetaData.getAnnotations()` that can be used to access annotation details using the `MergedAnnotations` interface. Where possible, the existing annotation methods have been migrated to call `getAnnotation()`, rather than needing their own implementation. The existing ASM based meta-data implementations have not been updated since they will be deprecated and replaced in a subsequent commit. See spring-projectsgh-22884
philwebb
added a commit
to philwebb/spring-framework
that referenced
this issue
May 6, 2019
Replace the existing ASM based readers with new implementations that also support MergedAnnotations. The meta-data classes themselves are now immutable, and constructed via separate reader classes. The `SimpleMetadataReader` class has been updated to return the new classes, however the old ones remain since some of them are public and might be being used directly. Closes spring-projectsgh-22884
jhoeller
pushed a commit
that referenced
this issue
May 7, 2019
Update TypeMappedAnnotation so that Strings can be used to represent Class attribute values. This will allow ASM annotation readers to present a `MergedAnnotation` instance without necessarily having the actual class values on the classpath. When the underlying value is a String, any calls to `getValue(name, String.class)` or `asMap(Adapt.CLASS_TO_STRING)` will simply return the original String. Calls that need the actual Class result (such as `getClass`) will use `Class.forName` and may throw a `ClassNotFoundException` at that point. This commit also allows an empty Object[] to be used to represent any empty primitive array. See gh-22884
jhoeller
pushed a commit
that referenced
this issue
May 7, 2019
Add a factory method to `MergedAnnotation` that allows an instance to be created for an explicit collection of root annotations. This method will allow ASM based readers to expose a `MergedAnnotation` instance that has root annotations loaded from bytecode, and meta-annotations loaded using reflection. See gh-22884
jhoeller
pushed a commit
that referenced
this issue
May 7, 2019
Add some additional tests to provide more coverage of class and method meta-data support. See gh-22884
jhoeller
pushed a commit
that referenced
this issue
May 7, 2019
Extract and pull-up some common method implementations and make them default methods of the interface. See gh-22884
jhoeller
pushed a commit
that referenced
this issue
May 7, 2019
Add `AnnotatedTypeMetaData.getAnnotations()` that can be used to access annotation details using the `MergedAnnotations` interface. Where possible, the existing annotation methods have been migrated to call `getAnnotation()`, rather than needing their own implementation. The existing ASM based meta-data implementations have not been updated since they will be deprecated and replaced in a subsequent commit. See gh-22884
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: enhancement
A general enhancement
We should now be able to expose
MergedAnnotations
fromAnnotatedTypeMetadata
to allow the new API to be used directly. Many of the existing methods can also be implemented with delegating class toMergedAnnotations
.We can probably also simplify the ASM reading code and lean on standard reflection to provide meta-data support.
The text was updated successfully, but these errors were encountered: