Details
Description
A DESCRIPTION OF THE PROBLEM :
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* does not have the 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 yeild value found".
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* does not have the 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 yeild value found".
Attachments
Issue Links
- links to
-
Review openjdk/jdk/19837