8247716: JVM_RegisterWhiteBoxMethods checks wrong classloader

Reviewed-by: dcubed
This commit is contained in:
Igor Ignatyev 2020-06-17 07:40:09 -07:00
parent 5547d3204d
commit f740cda526

View File

@ -2555,7 +2555,7 @@ JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
{
if (WhiteBoxAPI) {
// Make sure that wbclass is loaded by the null classloader
InstanceKlass* ik = InstanceKlass::cast(JNIHandles::resolve(wbclass)->klass());
InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(wbclass)));
Handle loader(THREAD, ik->class_loader());
if (loader.is_null()) {
WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));