[jdk17] RFR: 8268859: jshell throws exception while parsing illegal "case true"
Jan Lahoda
jlahoda at openjdk.java.net
Fri Jul 2 12:18:11 UTC 2021
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.
-------------
Commit messages:
- Formatting, cleanup.
- Adding missing files.
- Readding SuppressWarnings.
- Merge branch 'master' into JDK-8268859
- Improving disambiguation of expressions and patterns.
- Merge branch 'master' into JDK-8268859
- 8268859: jshell throws exception while parsing illegal "case true"
Changes: https://git.openjdk.java.net/jdk17/pull/202/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk17&pr=202&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8268859
Stats: 548 lines in 12 files changed: 279 ins; 206 del; 63 mod
Patch: https://git.openjdk.java.net/jdk17/pull/202.diff
Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/202/head:pull/202
PR: https://git.openjdk.java.net/jdk17/pull/202
More information about the compiler-dev
mailing list