Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ide-dev] Fwd: Simplified main methods -- what IDE users should expect?

Hi Mickael,

Am 08.05.25 um 20:30 schrieb Mickael Istria:
Hi,

I would prefer generating `void main(String[] args)`:
* I agree that if `public` is not necessary, we should skip it by default as in many cases, people may not want to make their "main" method a public API * I believe that in a strong-OO language, `static` methods can often become anti-pattern and thus shouldn't be recommended by default * and I think developers like to know without looking at documentation how to consume the command arguments, and (unlike `public`) that `args` are actually useful in many cases.

Cheers

Your comments seem to be in line with the discussion on amber-spec-experts.

In IntelliJ there appears to be one more option as they are talking about two templates, "main" and "psvm" (public static void main), where the latter obviously refers to the "old" verbose variant and will stay that way, which gives them more leg room to "modernize" the "main" template.

Rather than negotiating about tests for each part of the default, I'm quite intrigued by Brian's answer focusing on options to move back and forth between the different forms. This, BTW, is exactly what JDT did when lambdas where introduced: provide quick assists to go from anonymous class to lambda to method reference and back again.

Since JEP 512 is leaving previewing / will be a standard feature in 25, providing migration support for different forms of main methods sounds like a cool feature for 2025-06 (based on 24 preview) or 2025-09+Java25 patch.

Please see Brians post https://mail.openjdk.org/pipermail/amber-spec-experts/2025-May/004276.html

Anything I should add to that discussion on behalf of Eclipse?

Stephan


Back to the top