JEP 463: Implicitly Declared Classes (Second Preview) - Draft Spec Clarification

Ron Pressler ron.pressler at oracle.com
Tue Nov 28 18:30:59 UTC 2023



> On 28 Nov 2023, at 18:08, Leonid Arbuzov <leonid.arbouzov at oracle.com> wrote:
> 
> The JCK handles this by requesting an user to provide a command that start his tested JVM.
> The command can be as script, a wrapper code, etc.
> But it should be able to take a test main class name as an argument.
> There are other ways to start JVM (for example, manually) but still the JCK should be able
> to feed it with test main class name.

I see, so I think the most complete way to do this is have a mechanism to offer the implementation a source file for compilation *and* have the implementation say what class file it generated for top level classes in the file (there will be just one in the case of a “simple compilation unit”, i.e. a source file containing an implicit class).

Alternatively, the JCK could rely on the following from the new spec (although I don’t know to what extent that’s allowed):

"In simple implementations of the Java SE Platform, where compilation units are stored in files, the name of this implicitly declared class would typically be the name of the file containing the simple compilation unit minus any extension”

So if you can rely on the implementation being file-based (or at least rely on that by default), then you are allowed to infer the name of the class from the name of the source file. At least for such implementation you don’t need to have the implementation tell you what it named the top-level class.

— Ron


More information about the amber-dev mailing list