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

Jan Lahoda jlahoda at openjdk.java.net
Mon Nov 8 13:24:41 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.

This pull request has now been integrated.

Changeset: fa754b8f
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/fa754b8ffda0ae16cda03d896260870ff8fb6ae9
Stats:     13 lines in 2 files changed: 8 ins; 0 del; 5 mod

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

Reviewed-by: vromero

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

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


More information about the kulla-dev mailing list