Withdrawn: 8334722: Error emitted when switch expression does not yield any value lacks reasoning

Evemose duke at openjdk.org
Mon Jun 24 14:29:38 UTC 2024


On Fri, 21 Jun 2024 17:42:38 GMT, Evemose <duke at openjdk.org> wrote:

> Please review this trivial enhancement to informativity of error emiited when switch expression does not yield value in any branch lacks reasoning.
> 
> Issue body: 
> Currently, when switch expression does not yield any value, compiler emits following error: "switch expression does not have any result expressions". While this gives information on how to solve the issue, the exact reason of this error stays unclear, expecially because switch *statements* do not have same requirement. Recently, there even were question about this in one of jdk mailing lists.
> 
> The source of issue becomes obvious if we look where this error is reported: it is emmited in Attr class when javac is unable to assign type to switch expression. Therefore, I propose to change the emitted error text to following: "Unable to determine switch expression type: no branch that yields value found".
> 
> If anyone have ideas on how to furthernore improve this error message, please feel free to share.

This pull request has been closed without being integrated.

-------------

PR: https://git.openjdk.org/jdk/pull/19837


More information about the compiler-dev mailing list