6622385: Accessing protected static methods
Summary: Protected contraints should only be applied if member is not static
Reviewed-by: acorn, coleenp
--- a/hotspot/src/share/vm/runtime/reflection.cpp Sun Apr 13 17:43:42 2008 -0400
+++ b/hotspot/src/share/vm/runtime/reflection.cpp Wed Apr 16 17:36:29 2008 -0400
@@ -500,7 +500,8 @@
if (!protected_restriction) {
// See if current_class is a subclass of field_class
if (Klass::cast(current_class)->is_subclass_of(field_class)) {
- if (current_class == resolved_class ||
+ if (access.is_static() || // static fields are ok, see 6622385
+ current_class == resolved_class ||
field_class == resolved_class ||
Klass::cast(current_class)->is_subclass_of(resolved_class) ||
Klass::cast(resolved_class)->is_subclass_of(current_class)) {