src/hotspot/share/memory/metaspaceShared.cpp
changeset 48383 d6388b652504
parent 47765 b7c7428eaab9
child 48794 ea0d0781c63c
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Fri Dec 08 15:24:47 2017 -0500
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Fri Dec 08 15:14:08 2017 -0800
@@ -1627,14 +1627,16 @@
           log_trace(cds)("Shared spaces preloaded: %s", klass->external_name());
         }
 
-        InstanceKlass* ik = InstanceKlass::cast(klass);
+        if (klass->is_instance_klass()) {
+          InstanceKlass* ik = InstanceKlass::cast(klass);
 
-        // Link the class to cause the bytecodes to be rewritten and the
-        // cpcache to be created. The linking is done as soon as classes
-        // are loaded in order that the related data structures (klass and
-        // cpCache) are located together.
-        try_link_class(ik, THREAD);
-        guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+          // Link the class to cause the bytecodes to be rewritten and the
+          // cpcache to be created. The linking is done as soon as classes
+          // are loaded in order that the related data structures (klass and
+          // cpCache) are located together.
+          try_link_class(ik, THREAD);
+          guarantee(!HAS_PENDING_EXCEPTION, "exception in link_class");
+        }
 
         class_count++;
       }