RFR: 8259359: javac does not attribute unexpected super constructor invocation qualifier, and may crash
Vicente Romero
vromero at openjdk.java.net
Thu Jan 14 19:11:02 UTC 2021
On Mon, 11 Jan 2021 07:17:47 GMT, Guoxiong Li <github.com+13688759+lgxbslgx at openjdk.org> wrote:
> Hi all,
>
> Currently, javac doesn't attribute unexpected super constructor invocation qualifier. Please see the following code.
>
> public class SuperConstructorCallInErrorClass extends Undefined1 {
> public SuperConstructorCallInErrorClass(int i) {
> new Undefined2() { public void test(int i) { Undefined3 u; } }.super(); //<-------------------
> }
> }
>
> The code `new Undefined2() { public void test(int i) { Undefined3 u; } }` isn't attributed by javac.
> If we use options like `-XDshould-stop.at=FLOW -XDdev`, the compiler would crash.
>
> This patch fixes it and adds the corresponding test cases.
>
> Thank you for taking the time to review.
>
> Best Regards.
looks sensible, I like the fact that this new code is executed if the compiler has already detected an error, so we are already in recovery mode
-------------
Marked as reviewed by vromero (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/2021
More information about the compiler-dev
mailing list