Integrated: 8259359: javac does not attribute unexpected super constructor invocation qualifier, and may crash

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Wed Jan 27 18:15:42 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.

This pull request has now been integrated.

Changeset: 0eed2c33
Author:    Guoxiong Li <lgxbslgx at gmail.com>
Committer: Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/0eed2c33
Stats:     103 lines in 2 files changed: 103 ins; 0 del; 0 mod

8259359: javac does not attribute unexpected super constructor invocation qualifier, and may crash

Reviewed-by: vromero

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

PR: https://git.openjdk.java.net/jdk/pull/2021


More information about the compiler-dev mailing list