This commit is contained in:
Christian Thalinger 2013-07-02 22:51:23 -07:00
commit 3fb7de3d0d
2 changed files with 7 additions and 2 deletions

View File

@ -1137,7 +1137,12 @@ JVM_ENTRY(jobject, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh,
if (VerifyMethodHandles && caller_jh != NULL && if (VerifyMethodHandles && caller_jh != NULL &&
java_lang_invoke_MemberName::clazz(mname()) != NULL) { java_lang_invoke_MemberName::clazz(mname()) != NULL) {
Klass* reference_klass = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname())); Klass* reference_klass = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname()));
if (reference_klass != NULL) { if (reference_klass != NULL && reference_klass->oop_is_objArray()) {
reference_klass = ObjArrayKlass::cast(reference_klass)->bottom_klass();
}
// Reflection::verify_class_access can only handle instance classes.
if (reference_klass != NULL && reference_klass->oop_is_instance()) {
// Emulate LinkResolver::check_klass_accessability. // Emulate LinkResolver::check_klass_accessability.
Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh)); Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
if (!Reflection::verify_class_access(caller, if (!Reflection::verify_class_access(caller,

View File

@ -458,7 +458,7 @@ bool Reflection::verify_class_access(Klass* current_class, Klass* new_class, boo
// doesn't have a classloader. // doesn't have a classloader.
if ((current_class == NULL) || if ((current_class == NULL) ||
(current_class == new_class) || (current_class == new_class) ||
(InstanceKlass::cast(new_class)->is_public()) || (new_class->is_public()) ||
is_same_class_package(current_class, new_class)) { is_same_class_package(current_class, new_class)) {
return true; return true;
} }