< prev index next >

src/share/vm/classfile/verifier.cpp

Print this page




1987   // Get current loader and protection domain first.
1988   oop loader = current_class()->class_loader();
1989   oop protection_domain = current_class()->protection_domain();
1990 
1991   Klass* kls = SystemDictionary::resolve_or_fail(
1992     name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
1993     true, THREAD);
1994 
1995   if (log_is_enabled(Info, classresolve)) {
1996     instanceKlassHandle cur_class = current_class();
1997     Verifier::trace_class_resolution(kls, cur_class());
1998   }
1999   return kls;
2000 }
2001 
2002 bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
2003                                         Klass* target_class,
2004                                         Symbol* field_name,
2005                                         Symbol* field_sig,
2006                                         bool is_method) {
2007   No_Safepoint_Verifier nosafepoint;
2008 
2009   // If target class isn't a super class of this class, we don't worry about this case
2010   if (!this_class->is_subclass_of(target_class)) {
2011     return false;
2012   }
2013   // Check if the specified method or field is protected
2014   InstanceKlass* target_instance = InstanceKlass::cast(target_class);
2015   fieldDescriptor fd;
2016   if (is_method) {
2017     Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::find_overpass);
2018     if (m != NULL && m->is_protected()) {
2019       if (!this_class->is_same_class_package(m->method_holder())) {
2020         return true;
2021       }
2022     }
2023   } else {
2024     Klass* member_klass = target_instance->find_field(field_name, field_sig, &fd);
2025     if (member_klass != NULL && fd.is_protected()) {
2026       if (!this_class->is_same_class_package(member_klass)) {
2027         return true;




1987   // Get current loader and protection domain first.
1988   oop loader = current_class()->class_loader();
1989   oop protection_domain = current_class()->protection_domain();
1990 
1991   Klass* kls = SystemDictionary::resolve_or_fail(
1992     name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
1993     true, THREAD);
1994 
1995   if (log_is_enabled(Info, classresolve)) {
1996     instanceKlassHandle cur_class = current_class();
1997     Verifier::trace_class_resolution(kls, cur_class());
1998   }
1999   return kls;
2000 }
2001 
2002 bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
2003                                         Klass* target_class,
2004                                         Symbol* field_name,
2005                                         Symbol* field_sig,
2006                                         bool is_method) {
2007   NoSafepointVerifier nosafepoint;
2008 
2009   // If target class isn't a super class of this class, we don't worry about this case
2010   if (!this_class->is_subclass_of(target_class)) {
2011     return false;
2012   }
2013   // Check if the specified method or field is protected
2014   InstanceKlass* target_instance = InstanceKlass::cast(target_class);
2015   fieldDescriptor fd;
2016   if (is_method) {
2017     Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::find_overpass);
2018     if (m != NULL && m->is_protected()) {
2019       if (!this_class->is_same_class_package(m->method_holder())) {
2020         return true;
2021       }
2022     }
2023   } else {
2024     Klass* member_klass = target_instance->find_field(field_name, field_sig, &fd);
2025     if (member_klass != NULL && fd.is_protected()) {
2026       if (!this_class->is_same_class_package(member_klass)) {
2027         return true;


< prev index next >