Commit Graph

2316 Commits

Author SHA1 Message Date
Juergen Hoeller
bec3b0fa1a Deprecate JdkVersion (for optimistic compatibility with newer JDK generations)
Issue: SPR-13312
2015-08-12 16:14:43 +02:00
Sam Brannen
e20b47c3bc Ensure local aliases don't override meta-annotation
This commit introduces an additional test case to ensure that explicit
local attribute aliases (configured via @AliasFor) do not accidentally
override attributes of the same names in meta-annotations (i.e., by
convention).

Issue: SPR-13325
2015-08-12 14:38:01 +02:00
Sam Brannen
4317e76e79 Polish AnnotationUtilsTests 2015-08-12 14:36:54 +02:00
Sam Brannen
5deeaf348a Polish SynthesizedAnnotation support classes 2015-08-10 15:40:25 +02:00
Sam Brannen
f17173f6d5 Synthesize nested maps into annotations
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
2015-08-10 14:55:54 +02:00
Sam Brannen
8289036165 Throw exception if required meta-annotation is not present
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
2015-08-09 19:14:29 +02:00
Sam Brannen
78ff4ff542 Polish AnnotationUtilsTests 2015-08-09 16:48:38 +02:00
Sam Brannen
48b965ad33 Improve performance of NumberUtils
This commit aims to improve the space and time performance of
NumberUtils by invoking valueOf() factory methods instead of the
corresponding constructors when converting a number to a target class.
2015-08-06 19:42:03 +02:00
Sam Brannen
e0392d9da5 Polish NumberUtilsTests 2015-08-06 19:31:44 +02:00
Sam Brannen
15033c1cc9 Polish Javadoc for NumberUtils 2015-08-06 19:21:02 +02:00
Sam Brannen
c8d604bf05 Ensure @AliasFor overrides attribute in correct meta-annotation
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
2015-08-06 19:04:08 +02:00
Stephane Nicoll
1a659e3c1d Polish 2015-08-05 08:36:01 +02:00
Sam Brannen
1ff3af6da3 Improve Javadoc for Ordered/@Order regarding sort semantics 2015-07-30 15:24:04 +02:00
Sam Brannen
a07ba695b0 Make @Order @Documented 2015-07-30 15:21:32 +02:00
Sam Brannen
1c8ac2b2aa Update @AliasFor Javadoc regarding new 'value' alias
Issue: SPR-13289
2015-07-29 16:08:42 +02:00
Sam Brannen
725292081e Introduce 'value' alias for 'attribute' in @AliasFor
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
2015-07-29 15:27:06 +02:00
Juergen Hoeller
291550a484 AntPathMatcher allows for case-insensitive matching
Issue: SPR-13286
2015-07-29 12:38:41 +02:00
Juergen Hoeller
965fca808a Polishing 2015-07-29 01:08:16 +02:00
Sam Brannen
288d253b8b Introduce support for conditional lambda execution in Spring's Assume 2015-07-27 19:48:01 +02:00
Sam Brannen
b6c0e7cba3 Remove trailing whitespace in Java source code 2015-07-27 12:40:54 +02:00
Juergen Hoeller
0cce41eb94 Fixed exception message expectation plus formatting
Issue: SPR-13067
2015-07-17 16:19:11 +02:00
Juergen Hoeller
aedef43a9a Exception fine-tuning and general polishing
Issue: SPR-13067
2015-07-17 15:24:04 +02:00
Sam Brannen
0940f43a47 Stop documenting annotations using @AliasFor in Javadoc
The removed listing will later be incorporated into the reference manual
in a dedicated section.

Issue: SPR-11515
2015-07-08 15:13:09 +02:00
Juergen Hoeller
145d88d152 Polishing 2015-07-07 00:26:31 +02:00
Juergen Hoeller
df8e9638ee LinkedMultiValueMap explicitly supports deep copies
Issue: SPR-13201
2015-07-07 00:24:39 +02:00
Sam Brannen
67ac675e9a Polish AnnotationAttributes[Tests] 2015-07-06 14:41:52 +02:00
Juergen Hoeller
b7acddbb19 AnnotationAttributes stores and re-throws resolution exceptions
Issue: SPR-13177
2015-07-06 13:35:16 +02:00
Juergen Hoeller
265cd2ad1e Javadoc fine-tuning for 4.2 2015-06-30 18:02:42 +02:00
Sam Brannen
49aabd5ac2 Polish Javadoc for (Synthesizing)MethodParameter 2015-06-30 00:30:42 +02:00
Juergen Hoeller
dc1f921f5c Split between basic MethodParameter and SynthesizingMethodParameter
This split avoids a package tangle (between core and core.annotation) and also allows for selective use of raw annotation exposure versus synthesized annotations, with the latter primarily applicable to web and message handler processing at this point.

Issue: SPR-13153
2015-06-30 00:02:02 +02:00
Juergen Hoeller
a5349eb2f8 Base64Utils falls back to JAXB DatatypeConverter for String-based encoding
Issue: SPR-12938
2015-06-26 22:06:13 +02:00
Rossen Stoyanchev
b542b52775 Update Javadoc on AntPathMatcher 2015-06-25 09:41:59 -04:00
Sam Brannen
51e30dd221 Polish MimeType 2015-06-24 23:59:22 +02:00
Sam Brannen
89e504c2f1 Uses Charset instead of String in MimeType.equals()
Prior to this commit, Spring's MimeType checked for equality between
two MIME types based on the equality of their properties maps; however,
the properties maps contain string representations of the "charset"
values. Thus, "UTF-8" is never equal to "utf-8" which breaks the
contract for character set names which must be compared in a
case-insensitive manner.

This commit addresses this issue by ensuring that "charset" properties
in MimeType instances are compared as Java Charset instances, thereby
ignoring case when checking for equality between charset names.

Issue: SPR-13157
2015-06-23 22:30:25 +02:00
Sam Brannen
f2f58f1677 Polish Javadoc in MimeType 2015-06-23 21:26:50 +02:00
Sam Brannen
3da59178e5 Document attribute alias support in AnnotationUtils 2015-06-23 18:38:00 +02:00
Sam Brannen
2451594cdd Synthesize annotation arrays within AnnotationUtils
Issue: SPR-11393
2015-06-23 18:30:47 +02:00
Juergen Hoeller
3b6548f3c2 Tests for Base64Utils results between JDK 8 and Commons Codec
Issue: SPR-13146
2015-06-22 00:32:33 +02:00
Sam Brannen
d0c0d9fc5a Synthesize annotation from defaults
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
2015-06-20 18:27:36 +02:00
Sam Brannen
a0040245ca Resolve @Repeatable container in AnnotationUtils
This commit introduces support for automatically resolving a container
annotation configured via @Repeatable in AnnotationUtils'
getRepeatableAnnotations() and getDeclaredRepeatableAnnotations()
methods.

Issue: SPR-13068
2015-06-20 18:05:04 +02:00
Sam Brannen
80622803b2 Fix error in HTML syntax in Javadoc 2015-06-20 17:01:03 +02:00
Sam Brannen
594c330205 Honor contract of @Repeatable in AnnotationUtils
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
2015-06-20 16:53:46 +02:00
Sam Brannen
27d1ce84a3 Polishing 2015-06-20 01:45:46 +02:00
Sam Brannen
fb83e83e78 Honor contract of @Repeatable in AnnotationUtils
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
2015-06-20 01:21:39 +02:00
Sam Brannen
078d252d1e Delete trailing whitespace in Java source code 2015-06-19 17:09:52 +02:00
Sam Brannen
b36c9f9f23 Polish introspection failure handling in AnnotationUtils 2015-06-19 15:29:57 +01:00
Sam Brannen
23547a72f3 Clean up warnings and polish tests 2015-06-19 14:57:28 +01:00
Sam Brannen
20a1474554 Polishing 2015-06-19 14:40:01 +01:00
Sam Brannen
ece12f9d37 Synthesize annotation from map w/ minimal attributes
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
2015-06-19 14:27:23 +01:00
Sam Brannen
b65c277fc6 Update list of annotations using @AliasFor 2015-06-17 21:30:02 +01:00