Loosening requirements for super() invocation

Brian Goetz brian.goetz at oracle.com
Fri Jan 27 21:32:15 UTC 2023


This is coming together nicely!

Good catch on "can't have a return"; the precise way to state this is 
"statements that can complete abruptly for reasons X, Y and Z" (see JLS 
14.1).

The static context applies not only to the BlockStatements prior, but 
also the ExplicitCtorInvocation.



On 1/27/2023 3:52 PM, Archie Cobbs wrote:
> On Fri, Jan 27, 2023 at 12:16 PM Archie Cobbs <archie.cobbs at gmail.com> 
> wrote:
>
>     On Thu, Jan 26, 2023 at 5:51 PM Brian Goetz
>     <brian.goetz at oracle.com> wrote:
>
>         I think that's where we should start; if we are spectacularly
>         successful, we can come back for more.
>
>
>     OK thanks. Proceeding...
>
>
> JEP is updated <https://bugs.openjdk.org/browse/JDK-8300786>. Not 
> surprisingly, it has gotten a good bit simpler.
>
> Change log...
>
> - Removed discussions of 'this' escape, try { } blocks and 
> initialization order
> - Removed if/then example choosing between two different superclass 
> constructors
> - Restate JLS changes
>
> The updated JLS changes are:
>
> 1. Change the grammar for `ConstructorBody` to:
>
>     ConstructorBody:
>         { [BlockStatements] } ;
>         { [BlockStatements] ExplicitConstructorInvocation 
> [BlockStatements] } ;
>
> 2. Specify that the BlockStatements prior to 
> ExplicitConstructorInvocation are in a static context (§8.1.3)
>
> Reload & resume firing... :)
>
> -Archie
>
> -- 
> Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230127/713851a5/attachment.htm>


More information about the amber-dev mailing list