Skip to content

Commit 02c7719

Browse files
committed
Update Javadoc regarding convention-based annotation attribute overrides
This commit updates the Javadoc in various places to reflect the fact that support for convention-based annotation attribute overrides has been removed. See gh-28761
1 parent d5bfd7f commit 02c7719

File tree

6 files changed

+20
-26
lines changed

6 files changed

+20
-26
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java

+12-17
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
* repeatable annotations on {@link AnnotatedElement AnnotatedElements}.
3737
*
3838
* <p>{@code AnnotatedElementUtils} defines the public API for Spring's
39-
* meta-annotation programming model with support for <em>annotation attribute
40-
* overrides</em> and {@link AliasFor @AliasFor}. Note, however, that
41-
* {@code AnnotatedElementUtils} is effectively a facade for the
42-
* {@link MergedAnnotations} API. For fine-grained support consider using the
39+
* meta-annotation programming model with support for attribute aliases and
40+
* <em>annotation attribute overrides</em> configured via {@link AliasFor @AliasFor}.
41+
* Note, however, that {@code AnnotatedElementUtils} is effectively a facade for
42+
* the {@link MergedAnnotations} API. For fine-grained support consider using the
4343
* {@code MergedAnnotations} API directly. If you do not need support for
44-
* annotation attribute overrides, {@code @AliasFor}, or merged annotations,
45-
* consider using {@link AnnotationUtils} instead.
44+
* {@code @AliasFor} or merged annotations, consider using {@link AnnotationUtils}
45+
* instead.
4646
*
4747
* <p>Note that the features of this class are not provided by the JDK's
4848
* introspection facilities themselves.
@@ -286,9 +286,8 @@ public static boolean isAnnotated(AnnotatedElement element, String annotationNam
286286
* the annotation hierarchy <em>above</em> the supplied {@code element} and
287287
* merge that annotation's attributes with <em>matching</em> attributes from
288288
* annotations in lower levels of the annotation hierarchy.
289-
* <p>Attributes from lower levels in the annotation hierarchy override attributes
290-
* of the same name from higher levels, and {@link AliasFor @AliasFor} semantics are
291-
* fully supported, both within a single annotation and within the annotation hierarchy.
289+
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
290+
* a single annotation and within the annotation hierarchy.
292291
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search algorithm used by
293292
* this method will stop searching the annotation hierarchy once the first annotation
294293
* of the specified {@code annotationName} has been found. As a consequence,
@@ -550,10 +549,8 @@ public static boolean hasAnnotation(AnnotatedElement element, Class<? extends An
550549
* the annotation hierarchy <em>above</em> the supplied {@code element} and
551550
* merge that annotation's attributes with <em>matching</em> attributes from
552551
* annotations in lower levels of the annotation hierarchy.
553-
* <p>Attributes from lower levels in the annotation hierarchy override
554-
* attributes of the same name from higher levels, and
555-
* {@link AliasFor @AliasFor} semantics are fully supported, both
556-
* within a single annotation and within the annotation hierarchy.
552+
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
553+
* a single annotation and within the annotation hierarchy.
557554
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search algorithm
558555
* used by this method will stop searching the annotation hierarchy once the
559556
* first annotation of the specified {@code annotationType} has been found.
@@ -585,10 +582,8 @@ public static boolean hasAnnotation(AnnotatedElement element, Class<? extends An
585582
* the annotation hierarchy <em>above</em> the supplied {@code element} and
586583
* merge that annotation's attributes with <em>matching</em> attributes from
587584
* annotations in lower levels of the annotation hierarchy.
588-
* <p>Attributes from lower levels in the annotation hierarchy override
589-
* attributes of the same name from higher levels, and
590-
* {@link AliasFor @AliasFor} semantics are fully supported, both
591-
* within a single annotation and within the annotation hierarchy.
585+
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
586+
* a single annotation and within the annotation hierarchy.
592587
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search
593588
* algorithm used by this method will stop searching the annotation
594589
* hierarchy once the first annotation of the specified

spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@ int getAliasMapping(int attributeIndex) {
415415
* Get a mapped attribute value from the most suitable
416416
* {@link #getAnnotation() meta-annotation}.
417417
* <p>The resulting value is obtained from the closest meta-annotation,
418-
* taking into consideration both convention and alias based mapping rules.
419-
* For root mappings, this method will always return {@code null}.
418+
* taking into consideration alias based mapping rules. For root mappings,
419+
* this method will always return {@code null}.
420420
* @param attributeIndex the attribute index of the source attribute
421421
* @param metaAnnotationsOnly if only meta annotations should be considered.
422422
* If this parameter is {@code false} then aliases within the annotation will

spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
* meta-annotations to ultimately provide a quick way to map the attributes of
3737
* a root {@link Annotation}.
3838
*
39-
* <p>Supports convention based merging of meta-annotations as well as implicit
40-
* and explicit {@link AliasFor @AliasFor} aliases. Also provides information
41-
* about mirrored attributes.
39+
* <p>Supports merging of meta-annotations as well as implicit and explicit
40+
* {@link AliasFor @AliasFor} aliases. Also provides information about mirrored
41+
* attributes.
4242
*
4343
* <p>This class is designed to be cached so that meta-annotations only need to
4444
* be searched once, regardless of how many times they are actually used.

spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotation.java

-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,6 @@ <T extends Annotation> MergedAnnotation<T>[] getAnnotationArray(String attribute
490490
* it has not already been synthesized and one of the following is true.
491491
* <ul>
492492
* <li>The annotation declares attributes annotated with {@link AliasFor @AliasFor}.</li>
493-
* <li>The annotation is a composed annotation that relies on convention-based
494-
* annotation attribute overrides in meta-annotations.</li>
495493
* <li>The annotation declares attributes that are annotations or arrays of
496494
* annotations that are themselves synthesizable.</li>
497495
* </ul>

spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
* <li>Explicit and implicit {@link AliasFor @AliasFor} declarations on one or
4040
* more attributes within the annotation</li>
4141
* <li>Explicit {@code @AliasFor} declarations for a meta-annotation</li>
42-
* <li>Convention based attribute aliases for a meta-annotation</li>
4342
* <li>From a meta-annotation declaration</li>
4443
* </ul>
4544
*

spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,9 @@ enum RequestMethod {
13561356

13571357
/**
13581358
* Mock of {@code org.springframework.web.bind.annotation.PostMapping}, except
1359-
* that the path is overridden by convention with single String element.
1359+
* that the path is intended to be overridden by convention with single String
1360+
* element. However, convention-based annotation attribute overrides are no
1361+
* longer supported as of Spring Framework 7.0.
13601362
*/
13611363
@Retention(RetentionPolicy.RUNTIME)
13621364
@WebMapping(method = RequestMethod.POST, name = "")

0 commit comments

Comments
 (0)