Draft Spec for Statements before Super() (JEP 447)

Archie Cobbs archie.cobbs at gmail.com
Fri Apr 21 20:55:06 UTC 2023


Hi Alex,

Great comments - thanks. I like "pre-construction context" better also.

On Thu, Apr 20, 2023 at 5:42 PM Alex Buckley <alex.buckley at oracle.com>
wrote:

> You ban `return` in the prologue, but see below
> for a notional ctor body that I'm certain javac would sensibly reject
> for an unreachable `super();` "statement".)
>
> ```
> P: {
>      System.out.println("ctor started");
>      break P;
>      super();
> }
> System.out.println("ctor finished");
> ```
>

Maybe we need a parenthetical comment that points out how any nesting of a
super()/this() call inside a block or anything else is disallowed by the
language production for *ConstructorBody*, in 8.8.7, which effectively
requires *ExplicitConstructorInvocation* to be top level.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230421/28eeadfe/attachment.htm>


More information about the amber-dev mailing list