RFR: JDK-8226522: No compilation error reported when yield is used in incorrect context
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Sat Jun 29 21:04:57 UTC 2019
The fix looks good - but I suggest a refactoring of the condition which,
as is, is quite difficult to parse (for the human eyes).
Maybe factor away:
Name restrictedTypeName = restrictedTypeName(result, !allowVar)
?
Maurizio
On 28/06/2019 13:33, Jan Lahoda wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190629/22082741/attachment.html>
More information about the compiler-dev
mailing list