hotspot/src/share/vm/prims/jvm.cpp
changeset 37870 ed05be00b50d
parent 37479 14a195eaf2c5
child 38303 1d0016127806
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed May 11 11:04:17 2016 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu May 12 11:16:16 2016 -0700
@@ -3387,14 +3387,14 @@
   return (!access.is_private() && InstanceKlass::cast(current_class)->is_same_class_package(field_class));
 }
 
-// Return the first non-null class loader up the execution stack, or null
-// if only code from the null class loader is on the stack.
+// Return the first user-defined class loader up the execution stack, or null
+// if only code from the bootstrap or platform class loader is on the stack.
 
 JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
   for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
     vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
     oop loader = vfst.method()->method_holder()->class_loader();
-    if (loader != NULL) {
+    if (loader != NULL && !SystemDictionary::is_platform_class_loader(loader)) {
       return JNIHandles::make_local(env, loader);
     }
   }