RFR: JDK-8226510: No compilation error when switch expression has no result expressions

Vicente Romero vicente.romero at oracle.com
Fri Jun 21 19:49:19 UTC 2019


looks good, only a nit: shouldn't the message be:

switch expression does not have any _result_ expressions?

Vicente

On 6/21/19 11:52 AM, Jan Lahoda wrote:
> Hi,
>
> javac does not correctly detect situation where a switch expression 
> does not yield any value (but has some cases), like:
> switch (i) {
>      default -> throw new IllegalStateException();
> }
>
> The proposed solution is to add a check for this situation. Sadly, 
> this triggered updates of several tests (which also contained switch 
> expression which failed to yield a value), which had to be updated.
>
> Proposed patch:
> http://cr.openjdk.java.net/~jlahoda/8226510/webrev.00/
>
> JBS:
> https://bugs.openjdk.java.net/browse/JDK-8226510
>
> How does this look?
>
> Thanks,
>     Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190621/b1086033/attachment.html>


More information about the compiler-dev mailing list