RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v8]

Jaikiran Pai jpai at openjdk.org
Fri May 5 09:48:24 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/jdk/internal/misc/MainMethodFinder.java line 70:

> 68:                         correctArgs(method) &&
> 69:                         // Only statics in the declaring class
> 70:                         (!isStatic(method) || declc == refc)

Should this also exclude `abstract` and `native` methods named `main`?

src/java.base/share/classes/jdk/internal/misc/MainMethodFinder.java line 134:

> 132: 
> 133:     /**
> 134:      * {@return priority main method or null if none found}

I think this javadoc is perhaps outdated? The current implementation of this method throws a `NoSuchMethodException` when it can't find any eligible main method.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1185896198
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1185898281


More information about the core-libs-dev mailing list