Skip to content

Commit 0656922

Browse files
committed
Document that @⁠AliasFor(attribute) is optional in override use cases
This commit documents that `attribute` is optional in @⁠AliasFor for meta-annotation attribute overrides with the same name. Closes gh-34641
1 parent 603e559 commit 0656922

File tree

1 file changed

+5
-2
lines changed
  • spring-core/src/main/java/org/springframework/core/annotation

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -74,7 +74,8 @@
7474
* <ol>
7575
* <li>The attribute that is an alias for an attribute in a meta-annotation
7676
* must be annotated with {@code @AliasFor}, and {@link #attribute} must
77-
* reference the attribute in the meta-annotation.</li>
77+
* reference the attribute in the meta-annotation (unless both attributes have
78+
* the same name).</li>
7879
* <li>Aliased attributes must declare the same return type.</li>
7980
* <li>{@link #annotation} must reference the meta-annotation.</li>
8081
* <li>The referenced meta-annotation must be <em>meta-present</em> on the
@@ -191,6 +192,8 @@
191192

192193
/**
193194
* The name of the attribute that <em>this</em> attribute is an alias for.
195+
* <p>May be omitted if this attribute is an alias for an attribute in a
196+
* meta-annotation and both attributes have the same name.
194197
* @see #value
195198
*/
196199
@AliasFor("value")

0 commit comments

Comments
 (0)