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

Ron Pressler ron.pressler at oracle.com
Tue Nov 28 12:22:13 UTC 2023



> On 27 Nov 2023, at 20:25, Leonid Arbuzov <leonid.arbouzov at oracle.com> wrote:
> 
> 
> How the JCK can launch a test class not knowing its name in an implementation-independent manner?
> 

Is launching *any* Java program specified SE even if you do know the name of its main class?

For example, JLS §12.1.4 specifies the `main` method but doesn’t specify how the main class is launched. Does it matter, then, that the chosen name for the main class is implementation-specific given that launching the main class is also implementation-specific?

Perhaps the best way to test implicit classes, then, is from *within* the implicit class itself. Like any other main class, it is launched by some implementation-specific mechanism, but once you’re in it, everything is known. You can then get the chosen class name with `this.getClass()…`.

— Ron


More information about the amber-dev mailing list