RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v8]
Jaikiran Pai
jpai at openjdk.org
Fri May 5 10:00:41 UTC 2023
On Mon, 1 May 2023 13:06:24 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
>> Add flexible main methods and anonymous main classes to the Java language.
>
> Jim Laskey has updated the pull request incrementally with two additional commits since the last revision:
>
> - Anonymous main classes renamed to unnamed classes
> - Add test
src/java.base/share/classes/sun/launcher/LauncherHelper.java line 893:
> 891: * findMainMethod (above) will choose the correct method, based
> 892: * on its name and parameter type, however, we still have to
> 893: * ensure that the method is static (non-preview) and returns a void.
I think it's probably going to be easier to read and maintain if we moved these checks for `static` and `void` return type into the `MainMethodFinder.findMainMethod(...)` itself.
What I mean is once we return from the `findMainMethod(...)`, I think the callers, like this code here, shouldn't have to do additional checks to know if this main method is valid and can be used.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1185908021
More information about the build-dev
mailing list