comparison src/share/vm/runtime/reflection.cpp @ 18052:2373a1f4987c

8036533: Method for correct defaults 8036156: Limit default method hierarchy Summary: Fix protected access checks Reviewed-by: coleenp, lfoltan, acorn, ahgross
author hseigel
date Fri, 09 May 2014 15:21:20 -0400
parents 9a60f4ac6a37
children eaf39a954227
comparison
equal deleted inserted replaced
18051:21444610cb92 18052:2373a1f4987c
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
480 if (hc == NULL) return false; 480 if (hc == NULL) return false;
481 if (hc == host_klass) return true; 481 if (hc == host_klass) return true;
482 ik = InstanceKlass::cast(hc); 482 ik = InstanceKlass::cast(hc);
483 483
484 // There's no way to make a host class loop short of patching memory. 484 // There's no way to make a host class loop short of patching memory.
485 // Therefore there cannot be a loop here unles there's another bug. 485 // Therefore there cannot be a loop here unless there's another bug.
486 // Still, let's check for it. 486 // Still, let's check for it.
487 assert(--inf_loop_check > 0, "no host_klass loop"); 487 assert(--inf_loop_check > 0, "no host_klass loop");
488 } 488 }
489 } 489 }
490 490
549 } 549 }
550 550
551 if (access.is_protected()) { 551 if (access.is_protected()) {
552 if (!protected_restriction) { 552 if (!protected_restriction) {
553 // See if current_class (or outermost host class) is a subclass of field_class 553 // See if current_class (or outermost host class) is a subclass of field_class
554 if (host_class->is_subclass_of(field_class)) { 554 // An interface may not access protected members of j.l.Object
555 if (!host_class->is_interface() && host_class->is_subclass_of(field_class)) {
555 if (access.is_static() || // static fields are ok, see 6622385 556 if (access.is_static() || // static fields are ok, see 6622385
556 current_class == resolved_class || 557 current_class == resolved_class ||
557 field_class == resolved_class || 558 field_class == resolved_class ||
558 host_class->is_subclass_of(resolved_class) || 559 host_class->is_subclass_of(resolved_class) ||
559 resolved_class->is_subclass_of(host_class)) { 560 resolved_class->is_subclass_of(host_class)) {