RFR: 8278078: cannot reference super before supertype constructor has been called [v2]

Adam Sotona asotona at openjdk.java.net
Thu Dec 2 08:35:29 UTC 2021


On Wed, 1 Dec 2021 21:27:17 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fixed typo in test name
>
> test/langtools/tools/javac/8278078/EnclosingSuperTest.java line 7:
> 
>> 5:  * @run compile EclosingSuperTest.java
>> 6:  */
>> 7: public class EnclosingSuperTest {
> 
> My suggestion for another test is something like this:
> 
> 
> public class EnclosingSuperTest2 {
>     class InnerClass extends Exception {
>         InnerClass() {
>             this(EnclosingSuperTest2.super.toString());
>         }
>         
>         InnerClass(String s) { }
>     }
> }
> 
> 
> This test also pass before the problematic fix, and fails afterwards, so I think we should add it too.

Yes, now I understand.
I've extended set of "Valid" test cases and also added several "Invalid" test cases expecting to fail to compile.
During that work I found <self class>.super used in constructor arg is not failing compilation, so the Attr patch is also adjusted for that case.

However all the test cases here are still related to this and super in constructor args only, test matrix for other contexts should follow.

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

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


More information about the compiler-dev mailing list