JDK14 spec query : MethodHandles:dropLookupMode(int)

Andrew Leonard andrew_m_leonard at uk.ibm.com
Fri Feb 28 12:55:08 UTC 2020


Hi,
I'm hoping to get some clarification please on understanding the updated 
JDK14 spec for MethodHandles:dropLookupMode(int) :
    
http://cr.openjdk.java.net/~iris/se/14/build/latest/api/java.base/java/lang/invoke/MethodHandles.Lookup.html#dropLookupMode(int)
the following two testcases seem inconsistent with the spec, but do pass 
currently with the RI:
https://hg.openjdk.java.net/jdk/jdk14/file/e568ce785bdf/test/jdk/java/lang/invoke/DropLookupModeTest.java#l69
lookup = fullPowerLookup.dropLookupMode(UNCONDITIONAL);
        assertTrue(lookup.lookupClass() == lc);
        assertTrue(lookup.lookupModes() == 
(PUBLIC|MODULE|PACKAGE|PRIVATE)); <--- 
jdk14 spec has changed to say:
If UNCONDITIONAL is dropped then the resulting lookup has no access. <----


https://hg.openjdk.java.net/jdk/jdk14/file/e568ce785bdf/test/jdk/java/lang/invoke/DropLookupModeTest.java#l131
        assertPublicLookup(unconditionalLookup.dropLookupMode(PUBLIC), 
expected); <-------
jdk14 spec states:
If PUBLIC is dropped then the resulting lookup has no access


Which is correct the code/testcase or the jdk14 spec ?

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