Missing warning when using an instance main method

forax at univ-mlv.fr forax at univ-mlv.fr
Mon Sep 18 08:46:28 UTC 2023


> From: "Holo The Sage Wolf" <holo3146 at gmail.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "amber-dev" <amber-dev at openjdk.org>
> Sent: Monday, September 18, 2023 9:51:55 AM
> Subject: Re: Missing warning when using an instance main method

> Instance main method was introduced in JEP 445, this instance main method is in
> principle identical to the ""top level"" main method introduced in the same JEP
> (it is not really top level, but an instance method of an unnamed class).

> Why should this issued a warning?

All preview features emit a warning at compile time. 
Using an unnamed class emits a warning 

But using an instance main method does not. 

regards, 
Rémi 

> On Mon, Sep 18, 2023, 09:37 Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> Hello,
>> I believe this code should emit a warning when compiled given it uses an
>> instance main method

>> class MissingWarnings {
>> void main() {
>> }
>> }

>> But the command
>> javac --enable-preview --source 21 MissingWarnings.java
>> does not print a warning.

>> regards,
>> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230918/a0bf073b/attachment.htm>


More information about the amber-dev mailing list