|
20 | 20 | import java.lang.annotation.Documented;
|
21 | 21 | import java.lang.annotation.ElementType;
|
22 | 22 | import java.lang.annotation.Inherited;
|
| 23 | +import java.lang.annotation.Repeatable; |
23 | 24 | import java.lang.annotation.Retention;
|
24 | 25 | import java.lang.annotation.RetentionPolicy;
|
25 | 26 | import java.lang.annotation.Target;
|
|
77 | 78 | * @see AnnotationUtilsTests
|
78 | 79 | * @see MultipleComposedAnnotationsOnSingleAnnotatedElementTests
|
79 | 80 | * @see ComposedRepeatableAnnotationsTests
|
| 81 | + * @see NestedRepeatableAnnotationsTests |
80 | 82 | */
|
81 | 83 | class AnnotatedElementUtilsTests {
|
82 | 84 |
|
@@ -908,6 +910,31 @@ void getMergedAnnotationOnThreeDeepMetaWithValue() {
|
908 | 910 | assertThat(annotation.value()).containsExactly("FromValueAttributeMeta");
|
909 | 911 | }
|
910 | 912 |
|
| 913 | + /** |
| 914 | + * @since 5.3.25 |
| 915 | + */ |
| 916 | + @Test // gh-29685 |
| 917 | + void getMergedRepeatableAnnotationsWithContainerWithMultipleAttributes() { |
| 918 | + Set<StandardRepeatableWithContainerWithMultipleAttributes> repeatableAnnotations = |
| 919 | + AnnotatedElementUtils.getMergedRepeatableAnnotations( |
| 920 | + StandardRepeatablesWithContainerWithMultipleAttributesTestCase.class, |
| 921 | + StandardRepeatableWithContainerWithMultipleAttributes.class); |
| 922 | + assertThat(repeatableAnnotations).map(StandardRepeatableWithContainerWithMultipleAttributes::value) |
| 923 | + .containsExactly("a", "b"); |
| 924 | + } |
| 925 | + |
| 926 | + /** |
| 927 | + * @since 5.3.25 |
| 928 | + */ |
| 929 | + @Test // gh-29685 |
| 930 | + void findMergedRepeatableAnnotationsWithContainerWithMultipleAttributes() { |
| 931 | + Set<StandardRepeatableWithContainerWithMultipleAttributes> repeatableAnnotations = |
| 932 | + AnnotatedElementUtils.findMergedRepeatableAnnotations( |
| 933 | + StandardRepeatablesWithContainerWithMultipleAttributesTestCase.class, |
| 934 | + StandardRepeatableWithContainerWithMultipleAttributes.class); |
| 935 | + assertThat(repeatableAnnotations).map(StandardRepeatableWithContainerWithMultipleAttributes::value) |
| 936 | + .containsExactly("a", "b"); |
| 937 | + } |
911 | 938 |
|
912 | 939 | // -------------------------------------------------------------------------
|
913 | 940 |
|
@@ -1557,4 +1584,24 @@ class ForAnnotationsClass {
|
1557 | 1584 | static class ValueAttributeMetaMetaClass {
|
1558 | 1585 | }
|
1559 | 1586 |
|
| 1587 | + @Retention(RetentionPolicy.RUNTIME) |
| 1588 | + @interface StandardContainerWithMultipleAttributes { |
| 1589 | + |
| 1590 | + StandardRepeatableWithContainerWithMultipleAttributes[] value(); |
| 1591 | + |
| 1592 | + String name() default ""; |
| 1593 | + } |
| 1594 | + |
| 1595 | + @Retention(RetentionPolicy.RUNTIME) |
| 1596 | + @Repeatable(StandardContainerWithMultipleAttributes.class) |
| 1597 | + @interface StandardRepeatableWithContainerWithMultipleAttributes { |
| 1598 | + |
| 1599 | + String value() default ""; |
| 1600 | + } |
| 1601 | + |
| 1602 | + @StandardRepeatableWithContainerWithMultipleAttributes("a") |
| 1603 | + @StandardRepeatableWithContainerWithMultipleAttributes("b") |
| 1604 | + static class StandardRepeatablesWithContainerWithMultipleAttributesTestCase { |
| 1605 | + } |
| 1606 | + |
1560 | 1607 | }
|
0 commit comments