Integrated: 8301580: Error recovery does not clear returnResult
Jan Lahoda
jlahoda at openjdk.org
Mon Feb 6 12:28:02 UTC 2023
On Wed, 1 Feb 2023 12:00:58 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> Considering code like:
>
> class C {
> void m
> {
> return;
> }
> }
>
>
> `void m` is wrapped in an erroneous tree (which is good), and if/when `Attr` is processing it in `visitErroneous`, it will create a new `Env` to attribute the erroneous part.
>
> But, `Attr` will set a `returnResult` into the `Env`'s info - and that info is shared with the outter `Env`, so there will be a `returnResult` set after `visitErroneous`. `{ return ; }` is interpreted as an initializer, and there should be an error for the `return` there, but this error is missing, due to the set `returnResult`. This will then fail later in `Flow` with an exception:
>
>
> $ javac -XDshould-stop.at=FLOW -XDdev /tmp/C.java
This pull request has now been integrated.
Changeset: 522fa132
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/522fa1327422e49eaa172d43185b3d85b2561036
Stats: 108 lines in 3 files changed: 104 ins; 0 del; 4 mod
8301580: Error recovery does not clear returnResult
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/12361
More information about the kulla-dev
mailing list