JDK14 spec query : MethodHandles:dropLookupMode(int)
Chris Hegarty
chris.hegarty at oracle.com
Mon Mar 9 14:51:44 UTC 2020
Andrew,
> On 9 Mar 2020, at 10:06, Andrew Leonard <andrew_m_leonard at uk.ibm.com> wrote:
>
> Thank you Mandy for raising the bug, I have one more query please, we may want to add to the bug that I am not sure about:
> testDropLookupMode() in test/jdk/java/lang/invoke/modules/m3/jdk/test/ModuleAccessTest.java :
> public void testDropLookupMode() throws Exception {
> Lookup lookup = MethodHandles.privateLookupIn(m5.type1, m4.lookup);
> assertTrue((lookup.lookupModes() & MODULE) == 0); <--- MODULE doesn't exist
> ...
> Lookup lookup3 = lookup.dropLookupMode(MODULE);
> ---> assertTrue(lookup3.lookupModes() == (lookup.lookupModes() & ~(PROTECTED|PRIVATE|PACKAGE)));
>
>
> Based on the expected result above, does it mean PRIVATE, PACKAGE should be dropped whether
> or not MODULE exists in the access mode (PROTECTED is dropped by default) ?
> If so, the document should be updated to explicitly clarify the exception case?
I agree that this scenario would benefit from being clarified
( possibly as part of the existing issue [1] ).
-Chris.
[1] https://bugs.openjdk.java.net/browse/JDK-8240242
More information about the jdk-dev
mailing list