@@ -480,26 +480,28 @@ public Annotation[] getParameterAnnotations() {
480
480
Annotation [] anns = this .combinedAnnotations ;
481
481
if (anns == null ) {
482
482
anns = super .getParameterAnnotations ();
483
- for (Annotation [][] ifcAnns : getInterfaceParameterAnnotations ()) {
484
- int index = getParameterIndex ();
485
- if (index < ifcAnns .length ) {
486
- Annotation [] paramAnns = ifcAnns [index ];
487
- if (paramAnns .length > 0 ) {
488
- List <Annotation > merged = new ArrayList <>(anns .length + paramAnns .length );
489
- merged .addAll (Arrays .asList (anns ));
490
- for (Annotation paramAnn : paramAnns ) {
491
- boolean existingType = false ;
492
- for (Annotation ann : anns ) {
493
- if (ann .annotationType () == paramAnn .annotationType ()) {
494
- existingType = true ;
495
- break ;
483
+ int index = getParameterIndex ();
484
+ if (index >= 0 ) {
485
+ for (Annotation [][] ifcAnns : getInterfaceParameterAnnotations ()) {
486
+ if (index < ifcAnns .length ) {
487
+ Annotation [] paramAnns = ifcAnns [index ];
488
+ if (paramAnns .length > 0 ) {
489
+ List <Annotation > merged = new ArrayList <>(anns .length + paramAnns .length );
490
+ merged .addAll (Arrays .asList (anns ));
491
+ for (Annotation paramAnn : paramAnns ) {
492
+ boolean existingType = false ;
493
+ for (Annotation ann : anns ) {
494
+ if (ann .annotationType () == paramAnn .annotationType ()) {
495
+ existingType = true ;
496
+ break ;
497
+ }
498
+ }
499
+ if (!existingType ) {
500
+ merged .add (adaptAnnotation (paramAnn ));
496
501
}
497
502
}
498
- if (!existingType ) {
499
- merged .add (adaptAnnotation (paramAnn ));
500
- }
503
+ anns = merged .toArray (new Annotation [0 ]);
501
504
}
502
- anns = merged .toArray (new Annotation [0 ]);
503
505
}
504
506
}
505
507
}
0 commit comments