jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java
changeset 20496 430c1bccd943
parent 20481 2735b307d256
child 21361 6e4ef4e0097f
--- a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Wed Sep 18 20:12:05 2013 +0400
+++ b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Tue Oct 01 17:35:32 2013 -0400
@@ -128,14 +128,18 @@
         for (int i = 0; i < size; i++) {
             @SuppressWarnings("unchecked")
             ArrayList<TypeAnnotation> list = l[i];
+            TypeAnnotation[] typeAnnotations;
             if (list != null) {
-                TypeAnnotation[] typeAnnotations = list.toArray(new TypeAnnotation[0]);
-                result[i] = AnnotatedTypeFactory.buildAnnotatedType(types[i],
-                                                                    LocationInfo.BASE_LOCATION,
-                                                                    typeAnnotations,
-                                                                    typeAnnotations,
-                                                                    decl);
+                typeAnnotations = list.toArray(new TypeAnnotation[list.size()]);
+            } else {
+                typeAnnotations = EMPTY_TYPE_ANNOTATION_ARRAY;
             }
+            result[i] = AnnotatedTypeFactory.buildAnnotatedType(types[i],
+                                                                LocationInfo.BASE_LOCATION,
+                                                                typeAnnotations,
+                                                                typeAnnotations,
+                                                                decl);
+
         }
         return result;
     }