--- a/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Nov 17 15:54:48 2016 +0300
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp Thu Nov 17 14:23:29 2016 -0500
@@ -3525,17 +3525,24 @@
return false;
}
-oop java_lang_ClassLoader::non_reflection_class_loader(oop loader) {
+// Return true if this is one of the class loaders associated with
+// the generated bytecodes for reflection.
+bool java_lang_ClassLoader::is_reflection_class_loader(oop loader) {
if (loader != NULL) {
- // See whether this is one of the class loaders associated with
- // the generated bytecodes for reflection, and if so, "magically"
- // delegate to its parent to prevent class loading from occurring
- // in places where applications using reflection didn't expect it.
Klass* delegating_cl_class = SystemDictionary::reflect_DelegatingClassLoader_klass();
// This might be null in non-1.4 JDKs
- if (delegating_cl_class != NULL && loader->is_a(delegating_cl_class)) {
- return parent(loader);
- }
+ return (delegating_cl_class != NULL && loader->is_a(delegating_cl_class));
+ }
+ return false;
+}
+
+oop java_lang_ClassLoader::non_reflection_class_loader(oop loader) {
+ // See whether this is one of the class loaders associated with
+ // the generated bytecodes for reflection, and if so, "magically"
+ // delegate to its parent to prevent class loading from occurring
+ // in places where applications using reflection didn't expect it.
+ if (is_reflection_class_loader(loader)) {
+ return parent(loader);
}
return loader;
}