RFR: 8276149: jshell throws EOF error when throwing exception inside switch expression

Vicente Romero vromero at openjdk.java.net
Fri Nov 5 15:04:15 UTC 2021


On Tue, 2 Nov 2021 05:46:32 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> The completeness analysis does not correctly handle `case ... -> throw`, as it does not expect that `->` can be followed by `throw`, and as an ultimate consequence, it will consider this to be a complete snippet:
> 
> void t(int i) {
>      int v = switch (i) {
>           case 0 -> throw new IllegalStateException();
> 
> 
> While it apparently isn't a complete snippet.
> 
> The proposed solution is to add a special-case handling for this specific combination, which will ensure JShell will wait for more input for this snippet.

looks good

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

Marked as reviewed by vromero (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6207


More information about the kulla-dev mailing list