Commit Graph

10408 Commits

Author SHA1 Message Date
Sam Brannen c55486d5d5 Introduce alias for 'value' attribute in @RequestPart
Issue: SPR-11393
2015-05-31 16:32:45 +02:00
Sam Brannen 034e0e2cf4 Introduce alias for 'value' attribute in @RequestParam
Issue: SPR-11393
2015-05-31 16:20:38 +02:00
Sam Brannen 25a5d9d759 Introduce alias for 'value' attribute in @RequestHeader
Issue: SPR-11393
2015-05-31 16:20:33 +02:00
Sam Brannen c4c3ce796a Introduce alias for 'value' attribute in @CookieValue
Issue: SPR-11393
2015-05-31 16:07:27 +02:00
Sam Brannen 845f4f2bb7 Improve attribute alias support in @ComponentScan
Prior to this commit, @ComponentScan already had a value/basePackages
alias pair; however, the semantics were not properly enforced.

This commit addresses this issue by refactoring
ComponentScanAnnotationParser to ensure that it is not possible to
declare both of the aliased attributes. In addition, the 'value' and
'basePackages' attributes are now annotated with @AliasFor in order to
make the semantics clearer.

Issue: SPR-11393
2015-05-31 15:39:15 +02:00
Sam Brannen 94aa90646b Polish Javadoc for @ComponentScan 2015-05-31 15:32:56 +02:00
Sam Brannen 7b10dc6e93 Fix typo in Javadoc 2015-05-29 23:24:09 +02:00
Sam Brannen 60a5ec87d0 Introduce alias for 'value' attribute in @Header
This commit introduces 'name' as an alias for 'value' in @Header.

Issue: SPR-11393
2015-05-29 23:23:52 +02:00
Sam Brannen 35c3e7c0f3 Polishing 2015-05-29 23:10:25 +02:00
Sam Brannen 250787a35a Introduce alias for 'value' attribute in @Payload
This commit introduces 'expression' as an alias for 'value' in @Payload.

Issue: SPR-11393
2015-05-29 22:58:55 +02:00
Sam Brannen 518c85b107 Support synthesized annotations in MethodParameter 2015-05-29 22:48:55 +02:00
Sam Brannen 1afc938da1 Introduce synthesizeAnnotationArray() in AnnotationUtils 2015-05-29 22:45:34 +02:00
Sam Brannen 9f717871e6 Introduce getAnnotation() in AnnotatedElementUtils
This commit introduces a "synthesized annotation" alternative to
getAnnotationAttributes() in AnnotatedElementUtils, analogous to the
recently introduced findAnnotation() methods.

Issue: SPR-13082
2015-05-29 22:04:10 +02:00
Sam Brannen 9afcd17c71 Introduce getAnnotationAttributes(..,Class) in AnnoElUtils 2015-05-29 21:36:00 +02:00
Sam Brannen 46be176875 Allow AnnoConfigEx to propagate from getRepeatableAnnotation()
Issue: SPR-13084
2015-05-29 21:17:33 +02:00
Sam Brannen 8f233786ed Polishing 2015-05-29 02:05:44 +02:00
Sam Brannen 7018747cec Remove trailing whitespace in Java source code 2015-05-29 02:03:44 +02:00
Sam Brannen a31d1bdf60 Merge from sbrannen/SPR-13067
* SPR-13067:
  Synthesize annotation from a map of attributes
2015-05-29 01:43:50 +02:00
Sam Brannen e30c9b2ef3 Synthesize annotation from a map of attributes
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
2015-05-29 01:38:51 +02:00
Sam Brannen f41de12cf6 Ensure synthesized nested annotation arrays retain correct type
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
2015-05-27 17:55:10 +02:00
Sam Brannen a2f152ce8b Support nested annotations in AnnotationAttributes
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
2015-05-27 17:03:01 +02:00
Sam Brannen 0ac0e2ce20 Document public API in AnnotationAttributes
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
2015-05-27 16:15:25 +02:00
Sam Brannen 197f6594f4 Simplify annotation attribute override algorithm
Issue: SPR-11513
2015-05-24 17:59:30 +02:00
Sam Brannen c80932490f Complete documentation of synthesized annotations
Issue: SPR-11512
2015-05-24 16:42:09 +02:00
Sam Brannen b6f2d95c3e Cache computed values in SynthesizedAnnotationInvocationHandler
Issue: SPR-11512
2015-05-24 15:58:20 +02:00
Sam Brannen 8ecae8697a Cache attribute methods in AnnotationUtils
Issue: SPR-11512
2015-05-24 15:58:20 +02:00
Sam Brannen d5974a18ab Polish AnnotationUtils 2015-05-24 15:58:19 +02:00
Sam Brannen a1fc2097a1 Document SynthesizedAnnotationInvocationHandler constructor
Issue: SPR-11512
2015-05-24 15:58:07 +02:00
Sam Brannen c13f689537 Document isSynthesizable() in AnnotationUtils
Issue: SPR-11512
2015-05-24 00:13:53 +02:00
Sam Brannen 7f22f09890 PolishingPolish SynthesizedAnnotationInvocationHandler 2015-05-23 23:58:35 +02:00
Sam Brannen def7663ec4 Implement hashCode() for synthesized annotations
Issue: SPR-13066
2015-05-23 23:46:48 +02:00
Sam Brannen ae5c8285a6 Polish SynthesizedAnnotationInvocationHandler 2015-05-23 22:40:05 +02:00
Sam Brannen 7e2e9a80d0 Document getAttributeMethods() in AnnotationUtils
Issue: SPR-11512
2015-05-23 22:29:12 +02:00
Sam Brannen 7bf609f111 Implement equals() for synthesized annotations
Issue: SPR-13065
2015-05-23 22:29:12 +02:00
Juergen Hoeller c622f4c487 Polishing 2015-05-23 22:24:10 +02:00
Sam Brannen 62d1b4b6e8 Document getAttributeAliasMap() in AnnotationUtils
This commit also introduces a cache for attribute alias metadata.

Issue: SPR-11512
2015-05-23 20:30:03 +02:00
Juergen Hoeller 92bf32b9be Polishing 2015-05-23 20:04:48 +02:00
Juergen Hoeller e0a11f2ae7 SockJsTransportFailureException provides constructor variant without session id 2015-05-23 20:02:42 +02:00
Sam Brannen f5e096e2a0 Document @AliasFor
Issue: SPR-11512
2015-05-23 19:52:03 +02:00
Sam Brannen b9e13ea308 Align AnnotationAttributes.toString() with contract in Map 2015-05-23 18:25:50 +02:00
Sam Brannen f380689230 Don't use Java 8's Method.getParameterCount() 2015-05-23 18:18:03 +02:00
Sam Brannen 1e50d8d5c2 Implement toString() for synthesized annotations
Issue: SPR-13064
2015-05-23 18:09:39 +02:00
Sam Brannen ab92f4ed3a Document SynthesizedAnnotation support
Issue: SPR-11512
2015-05-23 01:01:39 +02:00
Juergen Hoeller 05d475a275 Polishing 2015-05-22 23:50:47 +02:00
Juergen Hoeller 5f60d700a1 Reordered Jackson initialization steps and restored HandlerInstantiator else block 2015-05-22 23:50:39 +02:00
Juergen Hoeller 41e4273a71 Upgrade to Jackson 2.6, JasperReports 6.1, OpenJPA 2.4 2015-05-22 23:50:31 +02:00
Juergen Hoeller d7a361315f Added further core features to 4.2 section 2015-05-22 23:50:22 +02:00
Sam Brannen 57e765f9ca Document annotation improvements & @AliasFor in new-in-4.2 2015-05-22 23:46:28 +02:00
Sam Brannen 9983add0f5 Polish new-in-4.2 section 2015-05-22 23:01:28 +02:00
Sam Brannen 347264e4d9 Add "Testing Improvements" to new-in-4.2 section 2015-05-22 22:53:31 +02:00