diff src/share/vm/prims/jvm.cpp @ 7611:ff0a7943fd29

8005994: Method annotations are allocated unnecessarily during class file parsing Summary: Also reviewed by: vitalyd@gmail.com Reviewed-by: coleenp, acorn
author stefank
date Tue, 15 Jan 2013 10:09:45 +0100
parents ade95d680b42
children f422634e5828
line wrap: on
line diff
--- a/src/share/vm/prims/jvm.cpp	Tue Jan 15 13:32:13 2013 +0100
+++ b/src/share/vm/prims/jvm.cpp	Tue Jan 15 10:09:45 2013 +0100
@@ -1582,8 +1582,11 @@
   if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
     if (k->oop_is_instance()) {
-      typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL);
-      return (jbyteArray) JNIHandles::make_local(env, a);
+      Annotations* type_annotations = InstanceKlass::cast(k)->type_annotations();
+      if (type_annotations != NULL) {
+        typeArrayOop a = Annotations::make_java_array(type_annotations->class_annotations(), CHECK_NULL);
+        return (jbyteArray) JNIHandles::make_local(env, a);
+      }
     }
   }
   return NULL;