JEP 463: Implicitly Declared Classes (Second Preview) - Draft Spec Clarification
Ron Pressler
ron.pressler at oracle.com
Mon Nov 27 18:20:29 UTC 2023
> On 27 Nov 2023, at 12:38, Sivakumar Gurusamy <sivakumar.gurusamy at oracle.com> wrote:
>
> Hello All,
> The JEP 445 (Unnamed Classes and Instance Main Methods (First Preview)) didn't define class name generated for unnamed classes that made difficult to develop JCK21 tests.
> Thanks to the change in JEP 463 (Implicitly Declared Classes and Instance Main Methods (Second Preview)). Now more JCK22 test can be developed and run.
> But some difficulty remain: As per JEP 463 class name is "determined by the host system".
> The spec hints typical algorithm how the class name can be generated.
> But what JCK tests can do in other (non-typical) cases ?
> A question: Can a host generate arbitrary class name indeterministically/randomly?
> If the generated class name can't be determined then execution step has to be skipped thus weakening tests.
> Please suggest.
> Thank you,
> JCK Team
Hi.
Let me first answer your question with a question: As the JEP and spec change state, the host-selected class name cannot and must not be used by Java source code; in that case, what tests specifically would you like to write that an arbitrarily chosen name could complicate?
Because the class name cannot be used in source code, there is nothing you can do with the class other than launch it, i.e. invoke its selected main method as the program’s entry point.
The assumption is that the chosen class name is either irrelevant for the launching process (when the source file is launched directly in source code mode, where the launcher is given the name of the .java file rather than the class name) or (possibly implicitly) made known to the user by the compiler; i.e. when you compile Foo.java, javac will produce a class file (typically Foo.class and perhaps others) that will then be used when launching the program, either directly on the command line or in the Main-Class attribute of an executable JAR’s manifest.
— Ron
More information about the amber-dev
mailing list