Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8242027: Clean up LinkResolver::check_klass_accessability
- Loading branch information
|
@@ -2566,9 +2566,7 @@ Handle SystemDictionary::find_java_mirror_for_type(Symbol* signature, |
|
|
// Check accessibility, emulating ConstantPool::verify_constant_pool_resolve. |
|
|
Klass* sel_klass = java_lang_Class::as_Klass(mirror()); |
|
|
if (sel_klass != NULL) { |
|
|
bool fold_type_to_class = true; |
|
|
LinkResolver::check_klass_accessability(accessing_klass, sel_klass, |
|
|
fold_type_to_class, CHECK_NH); |
|
|
LinkResolver::check_klass_accessibility(accessing_klass, sel_klass, CHECK_NH); |
|
|
} |
|
|
} |
|
|
return mirror; |
|
@@ -2633,9 +2631,7 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature, |
|
|
Klass* sel_klass = java_lang_Class::as_Klass(mirror); |
|
|
mirror = NULL; // safety |
|
|
// Emulate ConstantPool::verify_constant_pool_resolve. |
|
|
bool fold_type_to_class = true; |
|
|
LinkResolver::check_klass_accessability(accessing_klass, sel_klass, |
|
|
fold_type_to_class, CHECK_(empty)); |
|
|
LinkResolver::check_klass_accessibility(accessing_klass, sel_klass, CHECK_(empty)); |
|
|
} |
|
|
} |
|
|
assert(arg == npts, ""); |
|
|
|
@@ -272,19 +272,17 @@ void LinkInfo::print() { |
|
|
//------------------------------------------------------------------------------------------------------------------------ |
|
|
// Klass resolution |
|
|
|
|
|
void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass, |
|
|
bool fold_type_to_class, TRAPS) { |
|
|
void LinkResolver::check_klass_accessibility(Klass* ref_klass, Klass* sel_klass, TRAPS) { |
|
|
Klass* base_klass = sel_klass; |
|
|
if (fold_type_to_class) { |
|
|
if (sel_klass->is_objArray_klass()) { |
|
|
base_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass(); |
|
|
} |
|
|
// The element type could be a typeArray - we only need the access |
|
|
// check if it is a reference to another class. |
|
|
if (!base_klass->is_instance_klass()) { |
|
|
return; // no relevant check to do |
|
|
} |
|
|
if (sel_klass->is_objArray_klass()) { |
|
|
base_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass(); |
|
|
} |
|
|
// The element type could be a typeArray - we only need the access |
|
|
// check if it is a reference to another class. |
|
|
if (!base_klass->is_instance_klass()) { |
|
|
return; // no relevant check to do |
|
|
} |
|
|
|
|
|
Reflection::VerifyClassAccessResults vca_result = |
|
|
Reflection::verify_class_access(ref_klass, InstanceKlass::cast(base_klass), true); |
|
|
if (vca_result != Reflection::ACCESS_OK) { |
|
|
|
@@ -269,16 +269,7 @@ class LinkResolver: AllStatic { |
|
|
const constantPoolHandle& pool, int index, TRAPS); |
|
|
public: |
|
|
// constant pool resolving |
|
|
static void check_klass_accessability(Klass* ref_klass, Klass* sel_klass, |
|
|
bool fold_type_to_class, TRAPS); |
|
|
// The optional 'fold_type_to_class' means that a derived type (array) |
|
|
// is first converted to the class it is derived from (element type). |
|
|
// If this element type is not a class, then the check passes quietly. |
|
|
// This is usually what is needed, but a few existing uses might break |
|
|
// if this flag were always turned on. FIXME: See if it can be, always. |
|
|
static void check_klass_accessability(Klass* ref_klass, Klass* sel_klass, TRAPS) { |
|
|
return check_klass_accessability(ref_klass, sel_klass, false, THREAD); |
|
|
} |
|
|
static void check_klass_accessibility(Klass* ref_klass, Klass* sel_klass, TRAPS); |
|
|
|
|
|
// static resolving calls (will not run any Java code); |
|
|
// used only from Bytecode_invoke::static_target |
|
|
|
@@ -687,8 +687,7 @@ void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_c |
|
|
return; // short cut, typeArray klass is always accessible |
|
|
} |
|
|
Klass* holder = this_cp->pool_holder(); |
|
|
bool fold_type_to_class = true; |
|
|
LinkResolver::check_klass_accessability(holder, k, fold_type_to_class, CHECK); |
|
|
LinkResolver::check_klass_accessibility(holder, k, CHECK); |
|
|
} |
|
|
|
|
|
|
|
|