changeset 25537:087de200d457

8035788: Provide more consistency for lookups Reviewed-by: jrose, vlivanov, ahgross
author twisti
date Mon, 14 Jul 2014 13:57:44 +0400
parents a1ba79d447e0
children 421c18d84c71
files jdk/src/share/classes/java/lang/invoke/MethodHandles.java
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Mar 13 11:49:24 2014 +0400
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Mon Jul 14 13:57:44 2014 +0400
@@ -1505,6 +1505,10 @@
                 // that is *not* the bytecode behavior.
                 mods ^= Modifier.PROTECTED | Modifier.PUBLIC;
             }
+            if (Modifier.isProtected(mods) && refKind == REF_newInvokeSpecial) {
+                // cannot "new" a protected ctor in a different package
+                mods ^= Modifier.PROTECTED;
+            }
             if (Modifier.isFinal(mods) &&
                     MethodHandleNatives.refKindIsSetter(refKind))
                 throw m.makeAccessException("unexpected set of a final field", this);