[Resend] Draft Spec for Statements before Super() (JEP 447)
Guy Steele
guy.steele at oracle.com
Mon May 15 20:00:51 UTC 2023
Thank you. Overall looks good. Detailed comments:
8.8.7. In the BNF for ConstructorBody, in the second alternative, I believe that no brackets should appear around ExplicitConstructorInvocation:
{ [BlockStatements] [ExplicitConstructorInvocation] [BlockStatements] }
should be
{ [BlockStatements] ExplicitConstructorInvocation [BlockStatements] }
In the second paragraph, in "an invocation of the constructor of its direct superclass” I believe the word “its” should be “the”.
The fourth paragraph defines the phrase “prologue of [the/a] constructor body”, but the fifth paragraph twice uses the phrase “prologue of a constructor”, which is not defined.
12.5 In the list of six steps for processing a constructor, the logic is a bit difficult to follow because of nonparallelism, recapitulation, and a mixture of explicit “goto” instructions with drop-through. I suggest this refactored structure:
1. Assign the arguments for the constructor to newly created parameter variables for this constructor invocation.
2. If this constructor does not contain an explicit constructor invocation (8.8.7.1), go to step 4; otherwise, continue with step 3.
3. Execute the BlockStatements, if any, of the prologue of the constructor body. If execution of any statement completes abruptly, then execution of the constructor completes abruptly for the same reason; otherwise, continue with step 4.
4. If this constructor does not contain an explicit constructor invocation (8.8.7.1), go to step 6; otherwise, continue with step 5.
5. Evaluate the arguments of the explicit constructor invocation—it may be an invocation of of another constructor in the same class (using this) or an invocation of a superclass constructor (using super)—and process that constructor invocation recursively using this same nine-step procedure. If that constructor invocation completes abruptly, then this procedure completes abruptly for the same reason; otherwise, go to step 8.
6. If this constructor is a constructor for class Object, go to step 8; otherwise continue with step 7.
7. This constructor contains an implicit invocation super(); of a superclass constructor with no arguments. Process that superclass constructor invocation recursively using this same nine-step procedure. If that constructor invocation completes abruptly, then this procedure completes abruptly for the same reason. Otherwise, continue with step 8.
8. Execute the instance initializers and instance variable initializers for this class, assigning the values of instance variable initializers to the corresponding instance variables, in the left-to-right order in which they appear textually in the source code for the class. If execution of any of these initializers results in an exception, then no further initializers are processed and this procedure completes abruptly with that same exception. Otherwise, continue with step 9.
9. Execute the BlockStatements, if any, of the epilogue of this constructor. If execution of any statement completes abruptly, then this procedure completes abruptly for the same reason. Otherwise, this procedure completes normally.
Hope this helps.
—Guy
On May 12, 2023, at 5:08 AM, Gavin Bierman <gavin.bierman at oracle.com> wrote:
The latest draft of the spec change document for JEP 447 (Statements before super()) is available at:
https://cr.openjdk.org/~gbierman/jep447/latest/
Gavin
On 20 Apr 2023, at 22:29, Gavin Bierman <gavin.bierman at oracle.com> wrote:
Third time lucky:
Dear experts:
The first draft of the spec change document for the feature Statements before super() [1] is now available at:
https://cr.openjdk.org/~gbierman/jep447/latest/
Please give us your feedback (either on this list or directly to me).
Thanks,
Gavin
[1] Statements before super(): https://openjdk.org/jeps/447
On 20 Apr 2023, at 22:26, Gavin Bierman <gavin.bierman at oracle.com> wrote:
[Resending as the hyperlinks got mangled]
Dear experts:
The first draft of the spec change document for the feature Statements before super() [1] is now available at:
https://cr.openjdk.org/~gbierman/jep447/latest/ <https://cr.openjdk.org/~gbierman/jep440+44/latest/>
Please give us your feedback (either on this list or directly to me).
Thanks,
Gavin
[1] Statements before super(): https://openjdk.org/jeps/447 <https://openjdk.org/jeps/4>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230515/82702ddd/attachment.htm>
More information about the amber-dev
mailing list