RFR: 8294583: JShell: NPE in switch with non existing record pattern
Jan Lahoda
jlahoda at openjdk.org
Mon Nov 21 14:08:37 UTC 2022
On Sun, 20 Nov 2022 12:20:21 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
> 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?
I think I'd prefer the former, because we have a) "-XDshould-stop.at=FLOW", which is expected to actually run flow despite errors from Attr; b) quite often handling error by not running flow, the exceptions still happen in some cases (e.g. when we evaluate if a given code can complete normally from Attr), better to ensure Flow can handle the AST, IMO.
-------------
PR: https://git.openjdk.org/jdk/pull/11251
More information about the compiler-dev
mailing list