[jdk17] Integrated: 8268859: jshell throws exception while parsing illegal "case true"

Jan Lahoda jlahoda at openjdk.java.net
Wed Jul 7 07:29:51 UTC 2021


On Fri, 2 Jul 2021 12:11:52 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> Currently, broken case labels like `case true t` parse as patterns, whose type is `true`, which then fails later during annotation handling. This patch is trying to improve (and fix) the pattern/expression disambiguation again, making it more explicit than before. With this patch, only labels that begin with `<type> <name>` should be considered patterns.
> 
> The recently added no-preview part of `SwitchErrors` is moved to `PatternErrorRecovery.java`, because that indeed turned out to be difficult to maintain.

This pull request has now been integrated.

Changeset: 820f2900
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.java.net/jdk17/commit/820f2900d8650609d737d83141e91adc93daadf7
Stats:     548 lines in 12 files changed: 279 ins; 206 del; 63 mod

8268859: jshell throws exception while parsing illegal "case true"

Reviewed-by: mcimadamore

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

PR: https://git.openjdk.java.net/jdk17/pull/202


More information about the compiler-dev mailing list