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

Jim Laskey jlaskey at openjdk.org
Fri May 5 16:08:22 UTC 2023


On Fri, 5 May 2023 10:15:02 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> 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/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java line 457:
> 
>> 455:             if (isStatic) {
>> 456:                 if (noArgs) {
>> 457:                     mainMethod.invoke(appClass);
> 
> Given that `Method.invoke(...)` on a static method ignores the `obj` param that's passed to it, perhaps pass `null`?

Nostalgia and a useful reminder.

> test/jdk/tools/launcher/InstanceMainTest.java line 33:
> 
>> 31: public class InstanceMainTest extends TestHelper {
>> 32: 
>> 33:     @Test
> 
> Does this compile? I don't see imports for this annotation and this is launched as a `@run main ....`

Same package

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1186263733
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1186265984


More information about the core-libs-dev mailing list