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

MergedAnnotation meta-data support #22909

Merged
merged 14 commits into from
May 7, 2019
Merged

Commits on May 6, 2019

  1. Extract integration test classes from package-info

    Extract the inner classes from package-info into their own files to
    prevent local build problems and to make them easier to find.
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    979eb2b View commit details
    Browse the repository at this point in the history
  2. Add MergedAnnotation.getTypeHierarchy method

    Add a `getTypeHierarchy()` method to `MergedAnnotation` that can be used
    to return the full type hierarchy information. This method is
    specifically designed to be used in combination with
    `MergedAnnotationPredicates.unique`.
    
    This update also allows us to delete the `parentAndType` method
    from `AnnotatedElementUtils`.
    
    Closes spring-projectsgh-22908
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    969cc19 View commit details
    Browse the repository at this point in the history
  3. Rename some MergedAnnotation from methods to of

    Rename `from` to `of` for the `MergedAnnotation` factory methods that
    work with Maps. The previous name was a little confusing, especially
    when an annotation source parameter was specified. The new method name
    helps to make it clearer when the user is explicitly defining the
    attributes of the annotation, as opposed to picking them up from the
    source.
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    1fa806e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e6ab8a1 View commit details
    Browse the repository at this point in the history
  5. Support String->Class adaptation in MergedAnnotation

    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 committed May 6, 2019
    Configuration menu
    Copy the full SHA
    77cd957 View commit details
    Browse the repository at this point in the history
  6. Add MergedAnnotations.of method

    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 committed May 6, 2019
    Configuration menu
    Copy the full SHA
    9bd6cc1 View commit details
    Browse the repository at this point in the history
  7. Don't expose RetentionPolicy.CLASS annotations

    Update ASM based metadata readers so that only RetentionPolicy.RUNTIME
    annotations are exposed. This aligned behavior with the reflection based
    implementation.
    
    Closes spring-projectsgh-22886
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    f4519b4 View commit details
    Browse the repository at this point in the history
  8. Skip java.lang.annotations when reading metadata

    Update `StandardAnnotationMetadata` and `AnnotationMetadataReadingVisitor`
    so that `java.lang.annotation` annotations are consistently skipped.
    
    Closes spring-projectsgh-22885
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    71c62c7 View commit details
    Browse the repository at this point in the history
  9. Use ReflectionUtils to get declared methods

    Update `StandardAnnotationMetadata` to use `ReflectionUtils` when
    obtaining declared methods. This update is primarily so that the common
    method cache can be used.
    
    Closes spring-projectsgh-22907
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    6ccf7f0 View commit details
    Browse the repository at this point in the history
  10. Add additional class/method meta-data tests

    Add some additional tests to provide more coverage of class and method
    meta-data support.
    
    See spring-projectsgh-22884
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    86c4f96 View commit details
    Browse the repository at this point in the history
  11. Reduce meta-data code duplicate with default methods

    Extract and pull-up some common method implementations and make them
    default methods of the interface.
    
    See spring-projectsgh-22884
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    8717ba4 View commit details
    Browse the repository at this point in the history
  12. Add MergedAnnotations support to meta-data classes

    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 committed May 6, 2019
    Configuration menu
    Copy the full SHA
    5c00cc3 View commit details
    Browse the repository at this point in the history
  13. Add SimpleAnnotationMeta classes and readers

    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
    philwebb committed May 6, 2019
    Configuration menu
    Copy the full SHA
    4e25363 View commit details
    Browse the repository at this point in the history
  14. Deprecate StandardMetadata constructors

    Deprecate the public `StandardMetadata` constructors to make it clearer
    that these classes should not be instantiated directly. A new
    `AnnotationMetadata.introspect` factory method has been added which
    can now be used to obtain instances.
    
    This change will allow use to make the constructors package private
    and drop the `nestedAnnotationsAsMap` parameter in a future release.
    
    Closes spring-projectsgh-22906
    philwebb committed May 6, 2019
    Configuration menu