8036533: Method for correct defaults

8036156: Limit default method hierarchy

Fix protected access checks

Reviewed-by: coleenp, lfoltan, acorn, ahgross
This commit is contained in:
Harold Seigel 2014-07-22 16:16:51 +04:00
parent 7bd17413f2
commit f203dcbfbf
6 changed files with 36 additions and 27 deletions

View file

@ -507,7 +507,8 @@ bool Reflection::verify_field_access(Klass* current_class,
if (access.is_protected()) {
if (!protected_restriction) {
// See if current_class (or outermost host class) is a subclass of field_class
if (host_class->is_subclass_of(field_class)) {
// An interface may not access protected members of j.l.Object
if (!host_class->is_interface() && host_class->is_subclass_of(field_class)) {
if (access.is_static() || // static fields are ok, see 6622385
current_class == resolved_class ||
field_class == resolved_class ||