RFR: 8194743: Compiler implementation for Statements before super() [v16]

Gavin Bierman gbierman at openjdk.org
Thu Sep 28 10:16:31 UTC 2023


On Mon, 25 Sep 2023 17:52:58 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> @GavinBierman do you think the compiler message should mention the official JLS terminology?
>
> For instance:
> 
> 
> explicit constructor invocation may only appear within constructors
> 
> 
> 
> redundant explicit constructor invocation
> 
> 
> 
> explicit constructor invocation not allowed here
> 
> 
> 
> 'return'' not allowed before explicit constructor invocation

@mcimadamore Yes, I like the first. Something like "explicit constructor invocation may only appear within a constructor body" is good.

(The JLS actually says that an (explicit) constructor invocation, i.e. this(...) or super(...), is not a statement, but just a thing that can appear in a constructor body.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13656#discussion_r1339876223


More information about the compiler-dev mailing list