Commit Graph

10644 Commits

Author SHA1 Message Date
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
Brian Clozel 9e6494eef6 Reinstate WebContentGenerator.checkAndPrepare variant
Reinstate a variant of the `WebContentGenerator.checkAndPrepare` method
for projects that are using it.

This variant is now marked as deprecated.

Issue: SPR-11792
2015-05-22 22:31:56 +02:00
Sam Brannen bd787769be Introduce "synthesizable" cache in AnnotationUtils
Issue: SPR-11512
2015-05-22 21:40:36 +02:00
Sam Brannen 2e4dabb349 Polishing 2015-05-22 21:37:50 +02:00
Rossen Stoyanchev bbd3f902d0 Fix failing tests 2015-05-22 14:14:20 -04:00
Rossen Stoyanchev c48e8708a7 Fix NPE in DefaultSimpUserRegistry 2015-05-22 13:44:09 -04:00
Rossen Stoyanchev 92bd7bba50 Restore userSessionRegistry field in StompSubProtocolHandler
This change ensures that the deprecated UserSessionRegistry is still
used if configured.
2015-05-22 13:44:09 -04:00
Sam Brannen 3a2da3f701 Polish and reorganize new-in-4.2 section 2015-05-22 17:54:10 +02:00
Sam Brannen 73170224c9 Polish annotation utility tests 2015-05-22 17:46:34 +02:00
Andy Clement 91ed5b6b8c SpEL: ensure correct object used for nested #this references
Before this commit the object that #this would refer to in
nested expressions within projection/selection clauses was always
the root context object. This was incorrect as it should be the
element being projected/selected over. This commit introduces
a scope root context object which is set upon entering a new
scope (like when entering a projection or selection). Any
object. With this change this kind of expression now behaves:

where #this is the element of list1. Unqualified references
are also resolved against this scope root context object.

Issues: SPR-10417, SPR-12035, SPR-13055
2015-05-22 08:07:09 -07:00
Stephane Nicoll 5a3eea8adb Update what's new section 2015-05-22 16:54:14 +02:00
Sam Brannen e7ea92561d Verify that SynthesizedAnnotation must be public
This commit introduces a test that will fail if SynthesizedAnnotation is
not public as is required by the contract for getProxyClass() in
java.lang.reflect.Proxy.

Issue: SPR-13057
2015-05-22 16:42:26 +02:00
Sam Brannen ca09b1ff20 Introduce putIfAbsent() in AnnotationAttributes
Issue: SPR-13060
2015-05-22 15:52:49 +02:00
Rossen Stoyanchev 18946c829f Upgrade to Reactor 2.0.2 2015-05-22 09:24:02 -04:00
Rossen Stoyanchev 0db216daab Polish 2015-05-22 09:06:18 -04:00