RFR: 8294583: JShell: NPE in switch with non existing record pattern

Aggelos Biboudis abimpoudis at openjdk.org
Sun Nov 20 12:29:51 UTC 2022


This fixes a situation where attribution errors are not short circuiting the compilation of an expression, e.g., in case of a declaration missing in the JShell evaluation of a switch expression.

Now there are two options:

1. handle this in `handleSwitch` (specific to switches, and avoid the `NPE` raised according to the JBS description)
2. handle this centrally in the corresponding task that is used in two places: 1) JShell evaluation and 2) `tools.javac.combo`.

I adopted the second option. Any thoughts?

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

Commit messages:
 - 8294583: JShell: NPE in switch with non existing record pattern

Changes: https://git.openjdk.org/jdk/pull/11251/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11251&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294583
  Stats: 53 lines in 2 files changed: 52 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/11251.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11251/head:pull/11251

PR: https://git.openjdk.org/jdk/pull/11251


More information about the compiler-dev mailing list