Paving the on-ramp

Remi Forax forax at univ-mlv.fr
Wed Sep 28 21:13:06 UTC 2022


> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Kevin Bourrillion" <kevinb at google.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Sent: Wednesday, September 28, 2022 10:10:02 PM
> Subject: Re: Paving the on-ramp
>>> - Make the "args" parameter to `main` optional, by allowing the `java` launcher
>>> to
>>> first look for a main method with the traditional `main(String[])`
>>> signature, and then (if not found) for a main method with no arguments.

>> This seems to leave users vulnerable to some surprises, where the code they
>> think is being called isn't. Why not make it a compile-time error to provide
>> both forms?

> Currently, the treatment of methods called "main" is "and also"; it is a valid
> method, *and also* (if it has the right shape) can be used as a main entry
> point. Making this an error would take some valid programs and make them
> invalid, which seems a shift in the interpretation of the magic name "main". A
> warning is probably reasonable though.
The other solution is to do something similar to the compact constructor of a record, a compact main that have a syntax which is not currently valid in Java. 

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20220928/114a51d4/attachment.htm>


More information about the amber-spec-experts mailing list