JEP draft: Implicit Classes and Enhanced Main Methods (Preview)

Brian Goetz brian.goetz at
Wed Feb 15 16:41:29 UTC 2023

> Outside the scope of this JEP, but: a smarter launch protocol may be 
> useful for reasons beyond on-ramping. For example, instead of only 
> looking for default constructors, you could look for a constructor 
> taking an object of type LauchEnvironment, which is something to be 
> suitably defined.

Yes, though we're dipping into that water cautiously.  One thing that 
this JEP opens up is the ability for abstract classes to contribute a 
main method:

     abstract class TestCase {
         void main() { runTest(this.getClass()); }

and then any test case becomes launchable:

     class MyTestCase extends TestCase {
         // test case

just by running

     java MyTestCase

This eliminates a whole category of contortions that frameworks have to 
provide (or worse, often don't provide) for running a single test case, 
service, etc from the command line.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list