Browse Source

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
pull/34655/head
Sam Brannen 10 months ago
parent
commit
02c7719eef
  1. 29
      spring-core/src/main/java/org/springframework/core/annotation/AnnotatedElementUtils.java
  2. 4
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java
  3. 6
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMappings.java
  4. 2
      spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotation.java
  5. 1
      spring-core/src/main/java/org/springframework/core/annotation/MergedAnnotations.java
  6. 4
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

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

@ -36,13 +36,13 @@ import org.springframework.util.MultiValueMap; @@ -36,13 +36,13 @@ import org.springframework.util.MultiValueMap;
* repeatable annotations on {@link AnnotatedElement AnnotatedElements}.
*
* <p>{@code AnnotatedElementUtils} defines the public API for Spring's
* meta-annotation programming model with support for <em>annotation attribute
* overrides</em> and {@link AliasFor @AliasFor}. Note, however, that
* {@code AnnotatedElementUtils} is effectively a facade for the
* {@link MergedAnnotations} API. For fine-grained support consider using the
* meta-annotation programming model with support for attribute aliases and
* <em>annotation attribute overrides</em> configured via {@link AliasFor @AliasFor}.
* Note, however, that {@code AnnotatedElementUtils} is effectively a facade for
* the {@link MergedAnnotations} API. For fine-grained support consider using the
* {@code MergedAnnotations} API directly. If you do not need support for
* annotation attribute overrides, {@code @AliasFor}, or merged annotations,
* consider using {@link AnnotationUtils} instead.
* {@code @AliasFor} or merged annotations, consider using {@link AnnotationUtils}
* instead.
*
* <p>Note that the features of this class are not provided by the JDK's
* introspection facilities themselves.
@ -286,9 +286,8 @@ public abstract class AnnotatedElementUtils { @@ -286,9 +286,8 @@ public abstract class AnnotatedElementUtils {
* the annotation hierarchy <em>above</em> the supplied {@code element} and
* merge that annotation's attributes with <em>matching</em> attributes from
* annotations in lower levels of the annotation hierarchy.
* <p>Attributes from lower levels in the annotation hierarchy override attributes
* of the same name from higher levels, and {@link AliasFor @AliasFor} semantics are
* fully supported, both within a single annotation and within the annotation hierarchy.
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
* a single annotation and within the annotation hierarchy.
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search algorithm used by
* this method will stop searching the annotation hierarchy once the first annotation
* of the specified {@code annotationName} has been found. As a consequence,
@ -550,10 +549,8 @@ public abstract class AnnotatedElementUtils { @@ -550,10 +549,8 @@ public abstract class AnnotatedElementUtils {
* the annotation hierarchy <em>above</em> the supplied {@code element} and
* merge that annotation's attributes with <em>matching</em> attributes from
* annotations in lower levels of the annotation hierarchy.
* <p>Attributes from lower levels in the annotation hierarchy override
* attributes of the same name from higher levels, and
* {@link AliasFor @AliasFor} semantics are fully supported, both
* within a single annotation and within the annotation hierarchy.
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
* a single annotation and within the annotation hierarchy.
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search algorithm
* used by this method will stop searching the annotation hierarchy once the
* first annotation of the specified {@code annotationType} has been found.
@ -585,10 +582,8 @@ public abstract class AnnotatedElementUtils { @@ -585,10 +582,8 @@ public abstract class AnnotatedElementUtils {
* the annotation hierarchy <em>above</em> the supplied {@code element} and
* merge that annotation's attributes with <em>matching</em> attributes from
* annotations in lower levels of the annotation hierarchy.
* <p>Attributes from lower levels in the annotation hierarchy override
* attributes of the same name from higher levels, and
* {@link AliasFor @AliasFor} semantics are fully supported, both
* within a single annotation and within the annotation hierarchy.
* <p>{@link AliasFor @AliasFor} semantics are fully supported, both within
* a single annotation and within the annotation hierarchy.
* <p>In contrast to {@link #getAllAnnotationAttributes}, the search
* algorithm used by this method will stop searching the annotation
* hierarchy once the first annotation of the specified

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

@ -415,8 +415,8 @@ final class AnnotationTypeMapping { @@ -415,8 +415,8 @@ final class AnnotationTypeMapping {
* Get a mapped attribute value from the most suitable
* {@link #getAnnotation() meta-annotation}.
* <p>The resulting value is obtained from the closest meta-annotation,
* taking into consideration both convention and alias based mapping rules.
* For root mappings, this method will always return {@code null}.
* taking into consideration alias based mapping rules. For root mappings,
* this method will always return {@code null}.
* @param attributeIndex the attribute index of the source attribute
* @param metaAnnotationsOnly if only meta annotations should be considered.
* If this parameter is {@code false} then aliases within the annotation will

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

@ -36,9 +36,9 @@ import org.springframework.util.ConcurrentReferenceHashMap; @@ -36,9 +36,9 @@ import org.springframework.util.ConcurrentReferenceHashMap;
* meta-annotations to ultimately provide a quick way to map the attributes of
* a root {@link Annotation}.
*
* <p>Supports convention based merging of meta-annotations as well as implicit
* and explicit {@link AliasFor @AliasFor} aliases. Also provides information
* about mirrored attributes.
* <p>Supports merging of meta-annotations as well as implicit and explicit
* {@link AliasFor @AliasFor} aliases. Also provides information about mirrored
* attributes.
*
* <p>This class is designed to be cached so that meta-annotations only need to
* be searched once, regardless of how many times they are actually used.

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

@ -490,8 +490,6 @@ public interface MergedAnnotation<A extends Annotation> { @@ -490,8 +490,6 @@ public interface MergedAnnotation<A extends Annotation> {
* it has not already been synthesized and one of the following is true.
* <ul>
* <li>The annotation declares attributes annotated with {@link AliasFor @AliasFor}.</li>
* <li>The annotation is a composed annotation that relies on convention-based
* annotation attribute overrides in meta-annotations.</li>
* <li>The annotation declares attributes that are annotations or arrays of
* annotations that are themselves synthesizable.</li>
* </ul>

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

@ -39,7 +39,6 @@ import org.springframework.util.Assert; @@ -39,7 +39,6 @@ import org.springframework.util.Assert;
* <li>Explicit and implicit {@link AliasFor @AliasFor} declarations on one or
* more attributes within the annotation</li>
* <li>Explicit {@code @AliasFor} declarations for a meta-annotation</li>
* <li>Convention based attribute aliases for a meta-annotation</li>
* <li>From a meta-annotation declaration</li>
* </ul>
*

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

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

Loading…
Cancel
Save