1. 14 10月, 2015 1 次提交
  2. 10 10月, 2015 2 次提交
  3. 31 8月, 2015 1 次提交
  4. 29 8月, 2015 1 次提交
    • S
      Support implicit attribute aliases with @AliasFor · d40a35ba
      Sam Brannen 提交于
      Spring Framework 4.2 introduced support for aliases between annotation
      attributes that fall into the following two categories.
      
      1) Alias pairs: two attributes in the same annotation that use
         @AliasFor to declare that they are explicit aliases for each other.
      2) Meta-annotation attribute overrides: an attribute in one annotation
         uses @AliasFor to declare that it is an explicit override of an
         attribute in a meta-annotation.
      
      However, the existing functionality fails to support the case where two
      attributes in the same annotation both use @AliasFor to declare that
      they are both explicit overrides of the same attribute in the same
      meta-annotation. In such scenarios, one would intuitively assume that
      two such attributes would be treated as "implicit" aliases for each
      other, analogous to the existing support for explicit alias pairs.
      Furthermore, an annotation may potentially declare multiple aliases
      that are effectively a set of implicit aliases for each other.
      
      This commit introduces support for implicit aliases configured via
      @AliasFor through an extensive overhaul of the support for alias
      lookups, validation, etc. Specifically, this commit includes the
      following.
      
      - Introduced isAnnotationMetaPresent() in AnnotationUtils.
      
      - Introduced private AliasDescriptor class in AnnotationUtils in order
        to encapsulate the parsing, validation, and comparison of both
        explicit and implicit aliases configured via @AliasFor.
      
      - Switched from single values for alias names to lists of alias names.
      
      - Renamed getAliasedAttributeName() to getAliasedAttributeNames() in
        AnnotationUtils.
      
      - Converted alias map to contain lists of aliases in AnnotationUtils.
      
      - Refactored the following to support multiple implicit aliases:
        getRequiredAttributeWithAlias() in AnnotationAttributes,
        AbstractAliasAwareAnnotationAttributeExtractor,
        MapAnnotationAttributeExtractor, MergedAnnotationAttributesProcessor
        in AnnotatedElementUtils, and postProcessAnnotationAttributes() in
        AnnotationUtils.
      
      - Introduced numerous tests for implicit alias support, including
        AbstractAliasAwareAnnotationAttributeExtractorTestCase,
        DefaultAnnotationAttributeExtractorTests, and
        MapAnnotationAttributeExtractorTests.
      
      - Updated Javadoc in @AliasFor regarding implicit aliases and in
        AnnotationUtils regarding "meta-present".
      
      Issue: SPR-13345
      d40a35ba
  5. 22 8月, 2015 1 次提交
  6. 12 8月, 2015 2 次提交
  7. 10 8月, 2015 2 次提交
    • S
      Synthesize nested maps into annotations · f17173f6
      Sam Brannen 提交于
      Prior to this commit, attempting to synthesize an annotation from a map
      of annotation attributes that contained nested maps instead of nested
      annotations would result in an exception.
      
      This commit addresses this issue by properly synthesizing nested maps
      and nested arrays of maps into nested annotations and nested arrays of
      annotations, respectively.
      
      Issue: SPR-13338
      f17173f6
    • S
      Throw exception if required meta-annotation is not present · 82890361
      Sam Brannen 提交于
      It is a configuration error if an alias is declared via @AliasFor for
      an attribute in a meta-annotation and the meta-annotation is not
      meta-present. However, prior to this commit, the support for validating
      the configuration of @AliasFor in AnnotationUtils currently silently
      ignored such errors.
      
      This commit fixes this by throwing an AnnotationConfigurationException
      whenever a required meta-annotation is not present or meta-present on
      an annotation that declares an explicit alias for an attribute in the
      meta-annotation.
      
      Issue: SPR-13335
      82890361
  8. 09 8月, 2015 1 次提交
  9. 07 8月, 2015 1 次提交
    • S
      Ensure @AliasFor overrides attribute in correct meta-annotation · c8d604bf
      Sam Brannen 提交于
      Prior to this commit, an explicit override for an attribute in a
      meta-annotation configured via @AliasFor could potentially result in an
      incorrect override of an attribute of the same name but in the wrong
      meta-annotation.
      
      This commit fixes the algorithm in getAliasedAttributeName(Method,
      Class) in AnnotationUtils by ensuring that an explicit attribute
      override is only applied to the configured target meta-annotation
      (i.e., configured via the 'annotation' attribute in @AliasFor).
      
      Issue: SPR-13325
      c8d604bf
  10. 29 7月, 2015 1 次提交
    • S
      Introduce 'value' alias for 'attribute' in @AliasFor · 72529208
      Sam Brannen 提交于
      SPR-11512 introduced support for annotation attribute aliases via
      @AliasFor, requiring the explicit declaration of the 'attribute'
      attribute. However, for aliases within an annotation, this explicit
      declaration is unnecessary.
      
      This commit improves the readability of alias pairs declared within an
      annotation by introducing a 'value' attribute in @AliasFor that is an
      alias for the existing 'attribute' attribute. This allows annotations
      such as @ContextConfiguration from the spring-test module to declare
      aliases as follows.
      
      public @interface ContextConfiguration {
      
           @AliasFor("locations")
           String[] value() default {};
      
           @AliasFor("value")
           String[] locations() default {};
      
          // ...
      }
      
      Issue: SPR-13289
      72529208
  11. 17 7月, 2015 1 次提交
  12. 06 7月, 2015 2 次提交
  13. 21 6月, 2015 2 次提交
    • S
      Synthesize annotation from defaults · d0c0d9fc
      Sam Brannen 提交于
      This commit introduces a convenience method in AnnotationUtils for
      synthesizing an annotation from its default attribute values.
      
      TransactionalTestExecutionListener has been refactored to invoke this
      new convenience method.
      
      Issue: SPR-13087
      d0c0d9fc
    • S
      Resolve @Repeatable container in AnnotationUtils · a0040245
      Sam Brannen 提交于
      This commit introduces support for automatically resolving a container
      annotation configured via @Repeatable in AnnotationUtils'
      getRepeatableAnnotations() and getDeclaredRepeatableAnnotations()
      methods.
      
      Issue: SPR-13068
      a0040245
  14. 20 6月, 2015 3 次提交
    • S
      Honor contract of @Repeatable in AnnotationUtils · 594c3302
      Sam Brannen 提交于
      This commit introduces a minor bug fix for getRepeatableAnnotations()
      so that it fully complies with the contract of Java's
      getAnnotationsByType() method with regard to repeatable annotations
      declared on multiple superclasses.
      
      Issue: SPR-13068
      594c3302
    • S
      Polishing · 27d1ce84
      Sam Brannen 提交于
      27d1ce84
    • S
      Honor contract of @Repeatable in AnnotationUtils · fb83e83e
      Sam Brannen 提交于
      Prior to this commit, the implementation of getRepeatableAnnotation()
      in Spring's AnnotationUtils complied neither with the contract of
      getAnnotationsByType() nor with the contract of
      getDeclaredAnnotationsByType() as defined in AnnotatedElement in Java 8.
      
      Specifically, unexpected results can be encountered when using Spring's
      support for @Repeatable annotations: either annotations show up in the
      returned set in the wrong order, or annotations are returned in the set
      that should not even be found based on the semantics of @Repeatable.
      
      This commit remedies this problem by deprecating the existing
      getRepeatableAnnotation() methods and replacing them with new
      getRepeatableAnnotations() and getDeclaredRepeatableAnnotations()
      methods that comply with the contracts of Java's getAnnotationsByType()
      and getDeclaredAnnotationsByType(), respectively.
      
      Issue: SPR-13068
      fb83e83e
  15. 19 6月, 2015 1 次提交
    • S
      Synthesize annotation from map w/ minimal attributes · ece12f9d
      Sam Brannen 提交于
      The initial support for synthesizing an annotation from a Map (or
      AnnotationAttributes) introduced in SPR-13067 required that the map
      contain key-value pairs for every attribute defined by the supplied
      annotationType. However, there are use cases that would benefit from
      being able to supply a reduced set of attributes and still have the
      annotation synthesized properly.
      
      This commit refines the validation mechanism in
      MapAnnotationAttributeExtractor so that a reduced set of attributes may
      be supplied. Specifically, if an attribute is missing in the supplied
      map the attribute will be set either to value of its alias (if an alias
      value configured via @AliasFor exists) or to the value of the
      attribute's default value (if defined), and otherwise an exception will
      be thrown.
      
      Furthermore, TransactionalTestExecutionListener has been refactored to
      take advantage of this new feature by synthesizing an instance of
      @TransactionConfiguration solely from the default values of its
      declared attributes.
      
      Issue: SPR-13087
      ece12f9d
  16. 14 6月, 2015 1 次提交
    • S
      Revise method and parameter names in annotation support · 32c17bf5
      Sam Brannen 提交于
      In AnnotatedElementUtils, all methods pertaining to merging annotation
      attributes have been renamed to "getMerged*()" and "findMerged*()"
      accordingly. Existing methods such as getAnnotationAttributes(..) have
      been deprecated in favor of the more descriptive "merged" variants.
      This aligns the naming conventions in AnnotatedElementUtils with those
      already present in AnnotationReadingVisitorUtils.
      
      The use of "annotationType" as a variable name for the fully qualified
      class name of an annotation type has been replaced with
      "annotationName" in order to improve the readability and intent of the
      code base.
      
      In MetaAnnotationUtils.AnnotationDescriptor, getMergedAnnotation() has
      been renamed to synthesizeAnnotation(), and the method is now
      overridden in UntypedAnnotationDescriptor to always throw an
      UnsupportedOperationException in order to avoid potential run-time
      ClassCastExceptions.
      
      Issue: SPR-11511
      32c17bf5
  17. 13 6月, 2015 1 次提交
  18. 05 6月, 2015 1 次提交
  19. 04 6月, 2015 1 次提交
  20. 30 5月, 2015 3 次提交
  21. 29 5月, 2015 1 次提交
    • S
      Synthesize annotation from a map of attributes · e30c9b2e
      Sam Brannen 提交于
      Spring Framework 4.2 RC1 introduced support for synthesizing an
      annotation from an existing annotation in order to provide additional
      functionality above and beyond that provided by Java. Specifically,
      such synthesized annotations provide support for @AliasFor semantics.
      As luck would have it, the same principle can be used to synthesize an
      annotation from any map of attributes, and in particular, from an
      instance of AnnotationAttributes.
      
      The following highlight the major changes in this commit toward
      achieving this goal.
      
      - Introduced AnnotationAttributeExtractor abstraction and refactored
        SynthesizedAnnotationInvocationHandler to delegate to an
        AnnotationAttributeExtractor.
      
      - Extracted code from SynthesizedAnnotationInvocationHandler into new
        AbstractAliasAwareAnnotationAttributeExtractor and
        DefaultAnnotationAttributeExtractor implementation classes.
      
      - Introduced MapAnnotationAttributeExtractor for synthesizing an
        annotation that is backed by a map or AnnotationAttributes instance.
      
      - Introduced a variant of synthesizeAnnotation() in AnnotationUtils
        that accepts a map.
      
      - Introduced findAnnotation(*) methods in AnnotatedElementUtils that
        synthesize merged AnnotationAttributes back into an annotation of the
        target type.
      
      The following classes have been refactored to use the new support for
      synthesizing AnnotationAttributes back into an annotation.
      
      - ApplicationListenerMethodAdapter
      - TestAnnotationUtils
      - AbstractTestContextBootstrapper
      - ActiveProfilesUtils
      - ContextLoaderUtils
      - DefaultActiveProfilesResolver
      - DirtiesContextTestExecutionListener
      - TestPropertySourceAttributes
      - TestPropertySourceUtils
      - TransactionalTestExecutionListener
      - MetaAnnotationUtils
      - MvcUriComponentsBuilder
      - RequestMappingHandlerMapping
      
      In addition, this commit also includes changes to ensure that arrays
      returned by synthesized annotations are properly cloned first.
      
      Issue: SPR-13067
      e30c9b2e
  22. 27 5月, 2015 3 次提交
    • S
      Ensure synthesized nested annotation arrays retain correct type · f41de12c
      Sam Brannen 提交于
      Prior to this commit, when a nested array of annotations was
      synthesized while adapting values within an AnnotationAttributes map,
      the array was improperly replaced with an array of type Annotation[]
      instead of an array of the concrete annotation type, which can lead to
      unexpected run-time exceptions.
      
      This commit fixes this bug by replacing annotations in the existing
      array with synthesized versions of those annotations, thereby retaining
      the original array's component type.
      
      Issue: SPR-13077
      f41de12c
    • S
      Support nested annotations in AnnotationAttributes · a2f152ce
      Sam Brannen 提交于
      This commit introduces support in AnnotationAttributes for retrieving
      nested annotations that is on par with the existing type-safe support
      for retrieving nested AnnotationAttributes.
      
      Issue: SPR-13074
      a2f152ce
    • S
      Document public API in AnnotationAttributes · 0ac0e2ce
      Sam Brannen 提交于
      AnnotationAttributes has existed for several years, but none of the
      "get" methods that make up its public API are documented. In many
      cases, the behavior can be inferred from the name of the method, but
      for some methods there are "hidden gems" and unexpected behavior
      lurking behind the scenes.
      
      This commit addresses this issue by documenting all public methods. In
      addition, the hidden support for converting single elements into
      single-element arrays has also been documented and tested.
      
      Issue: SPR-13072
      0ac0e2ce
  23. 24 5月, 2015 3 次提交
  24. 23 5月, 2015 1 次提交
  25. 22 5月, 2015 3 次提交