1.1 --- a/src/share/vm/interpreter/linkResolver.cpp Wed Apr 17 08:20:02 2013 -0400 1.2 +++ b/src/share/vm/interpreter/linkResolver.cpp Thu Apr 18 08:05:35 2013 -0700 1.3 @@ -1014,13 +1014,28 @@ 1.4 resolved_method->name(), 1.5 resolved_method->signature())); 1.6 } 1.7 - // check if public 1.8 - if (!sel_method->is_public()) { 1.9 - ResourceMark rm(THREAD); 1.10 - THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), 1.11 - Method::name_and_sig_as_C_string(recv_klass(), 1.12 - sel_method->name(), 1.13 - sel_method->signature())); 1.14 + // check access 1.15 + if (sel_method->method_holder()->is_interface()) { 1.16 + // Method holder is an interface. Throw Illegal Access Error if sel_method 1.17 + // is neither public nor private. 1.18 + if (!(sel_method->is_public() || sel_method->is_private())) { 1.19 + ResourceMark rm(THREAD); 1.20 + THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), 1.21 + Method::name_and_sig_as_C_string(recv_klass(), 1.22 + sel_method->name(), 1.23 + sel_method->signature())); 1.24 + } 1.25 + } 1.26 + else { 1.27 + // Method holder is a class. Throw Illegal Access Error if sel_method 1.28 + // is not public. 1.29 + if (!sel_method->is_public()) { 1.30 + ResourceMark rm(THREAD); 1.31 + THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), 1.32 + Method::name_and_sig_as_C_string(recv_klass(), 1.33 + sel_method->name(), 1.34 + sel_method->signature())); 1.35 + } 1.36 } 1.37 // check if abstract 1.38 if (check_null_and_abstract && sel_method->is_abstract()) {