File tree 1 file changed +9
-1
lines changed
spring-core/src/main/java/org/springframework/core/annotation
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,8 @@ final class AnnotationTypeMapping {
69
69
70
70
private static final MirrorSet [] EMPTY_MIRROR_SETS = new MirrorSet [0 ];
71
71
72
+ private static final int [] EMPTY_INT_ARRAY = new int [0 ];
73
+
72
74
73
75
@ Nullable
74
76
private final AnnotationTypeMapping source ;
@@ -606,6 +608,9 @@ boolean isSynthesizable() {
606
608
607
609
608
610
private static int [] filledIntArray (int size ) {
611
+ if (size == 0 ) {
612
+ return EMPTY_INT_ARRAY ;
613
+ }
609
614
int [] array = new int [size ];
610
615
Arrays .fill (array , -1 );
611
616
return array ;
@@ -684,7 +689,7 @@ class MirrorSets {
684
689
private final MirrorSet [] assigned ;
685
690
686
691
MirrorSets () {
687
- this .assigned = new MirrorSet [attributes .size ()];
692
+ this .assigned = attributes . size () > 0 ? new MirrorSet [attributes .size ()] : EMPTY_MIRROR_SETS ;
688
693
this .mirrorSets = EMPTY_MIRROR_SETS ;
689
694
}
690
695
@@ -728,6 +733,9 @@ MirrorSet getAssigned(int attributeIndex) {
728
733
}
729
734
730
735
int [] resolve (@ Nullable Object source , @ Nullable Object annotation , ValueExtractor valueExtractor ) {
736
+ if (attributes .size () == 0 ) {
737
+ return EMPTY_INT_ARRAY ;
738
+ }
731
739
int [] result = new int [attributes .size ()];
732
740
for (int i = 0 ; i < result .length ; i ++) {
733
741
result [i ] = i ;
You can’t perform that action at this time.
0 commit comments