RFR (14): JDK-8236546: Yield with boolean expression and Object target type crashes javac.

Jan Lahoda jan.lahoda at oracle.com
Wed Jan 8 12:30:11 UTC 2020

Code like this crashes javac in Flow:

Object o = switch (s) { default -> s != null && s == s; };

The reason is that "s != null && s == s" will use split "when true" and 
"when false" (un/)initialized variables masks. But as the target type is 
not boolean, the merged (un/)initialized masks are needed. The real 
mistake is in using "scan" instead of "scanExpr" (which e.g. visitReturn 
does), so the proposal is to use "scanExpr" instead of "scan".

Proposed patch:

JBS: https://bugs.openjdk.java.net/browse/JDK-8236546

How does this look?


More information about the compiler-dev mailing list