--- 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);