- 14 10月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
-
- 10 10月, 2015 2 次提交
-
-
由 Sam Brannen 提交于
-
由 Sam Brannen 提交于
Issue: SPR-13554
-
- 31 8月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
This commit picks up where 3eacb837 (SPR-13345) left off by adding support for transitive implicit aliases configured via @AliasFor. Issue: SPR-13405
-
- 29 8月, 2015 1 次提交
-
-
由 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
-
- 22 8月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
-
- 12 8月, 2015 2 次提交
-
-
由 Sam Brannen 提交于
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
-
由 Sam Brannen 提交于
-
- 10 8月, 2015 2 次提交
-
-
由 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
-
由 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
-
- 09 8月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
-
- 07 8月, 2015 1 次提交
-
-
由 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
-
- 29 7月, 2015 1 次提交
-
-
由 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
-
- 17 7月, 2015 1 次提交
-
-
由 Juergen Hoeller 提交于
Issue: SPR-13067
-
- 06 7月, 2015 2 次提交
-
-
由 Sam Brannen 提交于
-
由 Juergen Hoeller 提交于
Issue: SPR-13177
-
- 21 6月, 2015 2 次提交
-
-
由 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
-
由 Sam Brannen 提交于
This commit introduces support for automatically resolving a container annotation configured via @Repeatable in AnnotationUtils' getRepeatableAnnotations() and getDeclaredRepeatableAnnotations() methods. Issue: SPR-13068
-
- 20 6月, 2015 3 次提交
-
-
由 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
-
由 Sam Brannen 提交于
-
由 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
-
- 19 6月, 2015 1 次提交
-
-
由 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
-
- 14 6月, 2015 1 次提交
-
-
由 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
-
- 13 6月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
Issue: SPR-11393
-
- 05 6月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
Issue: SPR-11393
-
- 04 6月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
Issue: SPR-11393
-
- 30 5月, 2015 3 次提交
-
-
由 Sam Brannen 提交于
This commit introduces a "synthesized annotation" alternative to getAnnotationAttributes() in AnnotatedElementUtils, analogous to the recently introduced findAnnotation() methods. Issue: SPR-13082
-
由 Sam Brannen 提交于
-
由 Sam Brannen 提交于
Issue: SPR-13084
-
- 29 5月, 2015 1 次提交
-
-
由 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
-
- 27 5月, 2015 3 次提交
-
-
由 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
-
由 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
-
由 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
-
- 24 5月, 2015 3 次提交
-
-
由 Sam Brannen 提交于
Issue: SPR-13066
-
由 Sam Brannen 提交于
Issue: SPR-13065
-
由 Sam Brannen 提交于
Issue: SPR-13064
-
- 23 5月, 2015 1 次提交
-
-
由 Sam Brannen 提交于
-
- 22 5月, 2015 3 次提交
-
-
由 Sam Brannen 提交于
-
由 Sam Brannen 提交于
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
-
由 Stephane Nicoll 提交于
-