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

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Fri Jan 22 06:07:58 UTC 2021


On Thu, 14 Jan 2021 19:08:02 GMT, Vicente Romero <vromero 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

@vicente-romero-oracle Could I get your help to sponsor this patch? Thanks a lot.

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

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


More information about the compiler-dev mailing list