On Thu, 27 Apr 2023 13:17:58 GMT, Jim Laskey <jlas...@openjdk.org> wrote:
>> Add flexible main methods and anonymous main classes to the Java language. > > Jim Laskey has updated the pull request incrementally with one additional > commit since the last revision: > > PreviewFeatures.isEnabled() src/java.base/share/classes/sun/launcher/LauncherHelper.java line 45: > 43: import java.lang.invoke.MethodHandles; > 44: import java.lang.invoke.MethodHandles.Lookup; > 45: import java.lang.invoke.MethodType; Left over from an earlier version? src/java.base/share/classes/sun/launcher/resources/launcher.properties line 240: > 238: Caused by: {1}: {2} > 239: java.launcher.cls.error8=\ > 240: Error: no non-private no argument constructor found in class {0} Since this feature is for new developers then the error messages will need to be understand, maybe it should be "zero argument" and give an example to help. src/java.base/share/native/libjli/java.c line 590: > 588: CHECK_EXCEPTION_NULL_LEAVE(mainID); > 589: (*env)->CallVoidMethod(env, mainObject, mainID); > 590: break; This calls into LauncherHelper to get the "main type", then calls the static or new/instance method. I'm wondering if you tried have a single entry point in LauncherHelper instead. I think the only downside might be that the trampoline would show up in stack traces but @Hidden could hide that. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179174808 PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179183719 PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179172679