Draft Spec for Unnamed Classes and Instance main Methods (JEP 445)
Gavin Bierman
gavin.bierman at oracle.com
Wed May 3 15:20:37 UTC 2023
Thanks Archie and Tagir. I have updated the spec.
Gavin
On 3 May 2023, at 15:23, Archie Cobbs <archie.cobbs at gmail.com> wrote:
I think this will be a nice addition.
On Tue, May 2, 2023 at 5:17 PM Gavin Bierman <gavin.bierman at oracle.com<mailto:gavin.bierman at oracle.com>> wrote:
The first draft of the spec change document for the feature Unnamed classes and instance main methods [1] (the "on-ramp" feature) is now available at:
https://cr.openjdk.org/~gbierman/jep445/latest/
1. Minor nit: "An unnamed top level class compilation unit implicitly declares an class..." - should be "a class".
2. Just to clarify my own understanding, is this correct? "Unnamed top level class" is a source code only concept; given a class file, it is not possible to definitively say whether it came from an "unnamed top level class".
3. The JEP shows an example of compiling a class "HelloWorld.java" into a class file "HelloWorld.java" and states "In this case the compiler chooses HelloWorld for the class name as an implementation detail". So far, so good. But then in the spec it says:
In simple implementations of the Java SE Platform, where compilation units are stored in files, the binary name of an unnamed top level class would typically be the name of the file containing the unnamed top level class compilation unit (7.3<https://cr.openjdk.org/~gbierman/jep445/jep445-20230502/specs/unnamed-classes-instance-main-methods-jls.html#jls-7.3>).
That would imply that the binary name of the JEP example would be "HelloWorld.java", not "HelloWorld". So maybe to clarify this should say "the name of the file (minus the ".java" suffix) containing the unnamed top level class compilation unit".
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20230503/da897935/attachment.htm>
More information about the amber-spec-experts
mailing list