diff -r 63e0c47ca943 -r f72d8917322a src/share/vm/ci/ciField.cpp --- a/src/share/vm/ci/ciField.cpp Thu Jul 17 10:21:31 2014 +0200 +++ b/src/share/vm/ci/ciField.cpp Fri Jul 18 09:04:01 2014 +0200 @@ -138,6 +138,17 @@ return; } + // Access check based on declared_holder. canonical_holder should not be used + // to check access because it can erroneously succeed. If this check fails, + // propagate the declared holder to will_link() which in turn will bail out + // compilation for this field access. + if (!Reflection::verify_field_access(klass->get_Klass(), declared_holder->get_Klass(), canonical_holder, field_desc.access_flags(), true)) { + _holder = declared_holder; + _offset = -1; + _is_constant = false; + return; + } + assert(canonical_holder == field_desc.field_holder(), "just checking"); initialize_from(&field_desc); }