提交 54293ab5 编写于 作者: T twisti

8035788: Provide more consistency for lookups

Reviewed-by: jrose, vlivanov, ahgross
上级 247027a8
...@@ -39,7 +39,9 @@ import sun.reflect.misc.ReflectUtil; ...@@ -39,7 +39,9 @@ import sun.reflect.misc.ReflectUtil;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandleNatives.Constants.*; import static java.lang.invoke.MethodHandleNatives.Constants.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
/** /**
...@@ -1504,6 +1506,10 @@ return mh1; ...@@ -1504,6 +1506,10 @@ return mh1;
// that is *not* the bytecode behavior. // that is *not* the bytecode behavior.
mods ^= Modifier.PROTECTED | Modifier.PUBLIC; 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) && if (Modifier.isFinal(mods) &&
MethodHandleNatives.refKindIsSetter(refKind)) MethodHandleNatives.refKindIsSetter(refKind))
throw m.makeAccessException("unexpected set of a final field", this); throw m.makeAccessException("unexpected set of a final field", this);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册