diff 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
line wrap: on
line diff
--- a/src/share/vm/runtime/reflection.cpp	Thu May 08 17:19:49 2014 -0400
+++ b/src/share/vm/runtime/reflection.cpp	Fri May 09 15:21:20 2014 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -482,7 +482,7 @@
     ik = InstanceKlass::cast(hc);
 
     // There's no way to make a host class loop short of patching memory.
-    // Therefore there cannot be a loop here unles there's another bug.
+    // Therefore there cannot be a loop here unless there's another bug.
     // Still, let's check for it.
     assert(--inf_loop_check > 0, "no host_klass loop");
   }
@@ -551,7 +551,8 @@
   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 ||