JDK14 spec query : MethodHandles:dropLookupMode(int)
Chris Hegarty
chris.hegarty at oracle.com
Mon Mar 9 17:45:06 UTC 2020
Mandy,
> On 9 Mar 2020, at 16:37, Mandy Chung <mandy.chung at oracle.com> wrote:
>
> I have bcc'ed jdk-dev and add core-libs-dev mailing list where this thread should be discussed.
>
> The spec says:
>
> "When dropping PACKAGE then the resulting lookup will not have PACKAGE or PRIVATE access. When dropping MODULE then the resulting lookup will not have MODULE, PACKAGE, or PRIVATE access. If PUBLIC is dropped then the resulting lookup has no access."
>
> @throws IAE if modeToDrop is a valid mode.
>
> I found the spec is quite clear that there is no condition to require the modeToDrop must exist.
Sure, I guess it somewhat depends on how you see 8240242 [1] turning
out. 8240242 clearly describes a similar(ish) issue where dropping
PUBLIC, when it is not currently held, has no effect, i.e. it does not
result in “no access” - this is either a bug in the implementation, or
a bug/clarification in the spec. If the latter, then there are some
scenarios where the outcome of passing a mode to dropLookupMode will
have some dependency on the actual held modes.
-Chris.
[1] https://bugs.openjdk.java.net/browse/JDK-8240242
More information about the core-libs-dev
mailing list