--- 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++;
}