RFR: JDK-8226522: No compilation error reported when yield is used in incorrect context

Jan Lahoda jan.lahoda at oracle.com
Fri Jun 28 12:33:31 UTC 2019


Hi,

For code like:
I i = (yield a) -> {};

interface I { public void test(String a); }

javac will compile the code, as if the "yield" was "var". This is 
because of a mistake in restricted types handling in this case.

Proposed fix is to ensure we are seeing "var" as the lambda parameter 
type, not yield.

Webrev: http://cr.openjdk.java.net/~jlahoda/8226522/webrev.00/
JBS: https://bugs.openjdk.java.net/browse/JDK-8226522

How does this look?

Thanks,
     Jan


More information about the compiler-dev mailing list