Integrated: 8278078: Cannot reference super before supertype constructor has been called

Adam Sotona asotona at openjdk.java.net
Thu Dec 2 15:32:33 UTC 2021


On Wed, 1 Dec 2021 16:32:55 GMT, Adam Sotona <asotona at openjdk.org> wrote:

> Pull request #4376 (with fix of 8261006: 'super' qualified method references cannot occur in a static context) regressed compilation of all inner classes using <enclosing class>.super pattern in their constructor argument to fail with: 
>  error: cannot reference super before supertype constructor has been called 
> 
> For example following source fragment cannot be compiled since that: 
> 
>     class EnclClass { 
>         class InnerClass extends Exception { 
>             InnerClass() { 
>                 super(EnclClass.super.toString()); 
>             } 
>         } 
>     } 
> 
> 
> This patch keeps throwing "cannot reference super" error for calls of <interface>.super and permits calls of <enclosing class>.super
> 
> Plus it adds a new test.
> 
> Thanks,
> Adam

This pull request has now been integrated.

Changeset: 8d9cb2ef
Author:    Adam Sotona <asotona at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/8d9cb2efe655cc3945b3fe51a5e7d90f48b688e6
Stats:     162 lines in 4 files changed: 161 ins; 0 del; 1 mod

8278078: Cannot reference super before supertype constructor has been called

Reviewed-by: mcimadamore

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

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


More information about the compiler-dev mailing list