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

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Mon Jan 11 07:22:08 UTC 2021


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.

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

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

Changes: https://git.openjdk.java.net/jdk/pull/2021/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2021&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259359
  Stats: 104 lines in 2 files changed: 103 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2021.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2021/head:pull/2021

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


More information about the compiler-dev mailing list