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

Leonid Arbuzov leonid.arbouzov at oracle.com
Tue Nov 28 18:59:50 UTC 2023


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

Yes, the JCK can use that typically generated class names. This might 
work for the most Java SE implementations. Original question was what 
should the JCK do for those *non-typical* implementations? The JCK can 
ask an user to provide a custom converter (source name to class name).

But this would not work for implementations that generate class names 
indeterministically. Hopefully there will be none or a few of such ones 
and the JCK can run a weaker tests for them. But a concern was that JCK 
users would be allowed to choose to run those weaker tests...

Can the spec somehow close this option? Or the JCK can close it on its own?

Thanks, -leonid

On 11/28/2023 10:30 AM, Ron Pressler wrote:
>
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20231128/4887a31b/attachment-0001.htm>


More information about the amber-dev mailing list