@@ -244,6 +244,7 @@ public void composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsin
244
244
assertMultipleAnnotationsWithIdenticalAttributeNames (metadata );
245
245
}
246
246
247
+
247
248
private void assertMultipleAnnotationsWithIdenticalAttributeNames (AnnotationMetadata metadata ) {
248
249
AnnotationAttributes attributes1 = (AnnotationAttributes ) metadata .getAnnotationAttributes (
249
250
NamedAnnotation1 .class .getName (), false );
@@ -292,6 +293,8 @@ private void doTestAnnotationInfo(AnnotationMetadata metadata) {
292
293
assertEquals ("direct" , method .getAnnotationAttributes (DirectAnnotation .class .getName ()).get ("value" ));
293
294
List <Object > allMeta = method .getAllAnnotationAttributes (DirectAnnotation .class .getName ()).get ("value" );
294
295
assertThat (new HashSet <Object >(allMeta ), is (equalTo (new HashSet <Object >(Arrays .asList ("direct" , "meta" )))));
296
+ allMeta = method .getAllAnnotationAttributes (DirectAnnotation .class .getName ()).get ("additional" );
297
+ assertThat (new HashSet <Object >(allMeta ), is (equalTo (new HashSet <Object >(Arrays .asList ("direct" )))));
295
298
296
299
assertTrue (metadata .isAnnotated (IsAnnotatedAnnotation .class .getName ()));
297
300
@@ -332,6 +335,8 @@ private void doTestAnnotationInfo(AnnotationMetadata metadata) {
332
335
assertEquals ("direct" , metadata .getAnnotationAttributes (DirectAnnotation .class .getName ()).get ("value" ));
333
336
allMeta = metadata .getAllAnnotationAttributes (DirectAnnotation .class .getName ()).get ("value" );
334
337
assertThat (new HashSet <Object >(allMeta ), is (equalTo (new HashSet <Object >(Arrays .asList ("direct" , "meta" )))));
338
+ allMeta = metadata .getAllAnnotationAttributes (DirectAnnotation .class .getName ()).get ("additional" );
339
+ assertThat (new HashSet <Object >(allMeta ), is (equalTo (new HashSet <Object >(Arrays .asList ("direct" )))));
335
340
}
336
341
{ // perform tests with classValuesAsString = true
337
342
AnnotationAttributes specialAttrs = (AnnotationAttributes ) metadata .getAnnotationAttributes (
@@ -407,14 +412,16 @@ public static enum SomeEnum {
407
412
NestedAnno [] optionalArray () default { @ NestedAnno (value = "optional" , anEnum = SomeEnum .DEFAULT , classArray = Void .class ) };
408
413
}
409
414
410
- @ Target ({ ElementType .TYPE , ElementType .METHOD })
415
+ @ Target ({ElementType .TYPE , ElementType .METHOD })
411
416
@ Retention (RetentionPolicy .RUNTIME )
412
417
public @interface DirectAnnotation {
413
418
414
419
String value ();
420
+
421
+ String additional () default "direct" ;
415
422
}
416
423
417
- @ Target ({ ElementType .TYPE } )
424
+ @ Target (ElementType .TYPE )
418
425
@ Retention (RetentionPolicy .RUNTIME )
419
426
public @interface IsAnnotatedAnnotation {
420
427
}
@@ -424,9 +431,11 @@ public static enum SomeEnum {
424
431
@ DirectAnnotation ("meta" )
425
432
@ IsAnnotatedAnnotation
426
433
public @interface MetaAnnotation {
434
+
435
+ String additional () default "meta" ;
427
436
}
428
437
429
- @ Target ({ ElementType .TYPE , ElementType .METHOD })
438
+ @ Target ({ElementType .TYPE , ElementType .METHOD })
430
439
@ Retention (RetentionPolicy .RUNTIME )
431
440
@ MetaAnnotation
432
441
public @interface MetaMetaAnnotation {
@@ -446,17 +455,18 @@ public static enum SubclassEnum {
446
455
},
447
456
BAR {
448
457
/* Do not delete! This subclassing is intentional. */
449
- };
458
+ }
450
459
}
451
460
452
461
@ Component ("myName" )
453
462
@ Scope ("myScope" )
454
- @ SpecialAttr (clazz = String .class , state = Thread .State .NEW , nestedAnno = @ NestedAnno (value = "na" , anEnum = SomeEnum .LABEL1 , classArray = { String .class }), nestedAnnoArray = {
455
- @ NestedAnno , @ NestedAnno (value = "na1" , anEnum = SomeEnum .LABEL2 , classArray = { Number .class }) })
456
- @ SuppressWarnings ({ "serial" , "unused" })
463
+ @ SpecialAttr (clazz = String .class , state = Thread .State .NEW ,
464
+ nestedAnno = @ NestedAnno (value = "na" , anEnum = SomeEnum .LABEL1 , classArray = {String .class }),
465
+ nestedAnnoArray = {@ NestedAnno , @ NestedAnno (value = "na1" , anEnum = SomeEnum .LABEL2 , classArray = {Number .class })})
466
+ @ SuppressWarnings ({"serial" , "unused" })
457
467
@ DirectAnnotation ("direct" )
458
468
@ MetaMetaAnnotation
459
- @ EnumSubclasses ({ SubclassEnum .FOO , SubclassEnum .BAR })
469
+ @ EnumSubclasses ({SubclassEnum .FOO , SubclassEnum .BAR })
460
470
private static class AnnotatedComponent implements Serializable {
461
471
462
472
@ TestAutowired
0 commit comments