JDK14 spec query : MethodHandles:dropLookupMode(int)

Andrew Leonard andrew_m_leonard at uk.ibm.com
Mon Mar 9 10:06:35 UTC 2020


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?

Thanks,
Andrew

Andrew Leonard
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
internet email: andrew_m_leonard at uk.ibm.com 

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



More information about the jdk-dev mailing list