RFR: JDK-8306112 Implementation of JEP 445: Flexible Main Methods and Anonymous Main Classes (Preview) [v2]
Jim Laskey
jlaskey at openjdk.org
Thu Apr 27 18:22:23 UTC 2023
On Thu, 27 Apr 2023 13:39:37 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> 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?
Yep.
> 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.
java.launcher.cls.error8=\
Error: no non-private zero argument constructor found in class {0}\n\
remove private from existing constructor or define as:\n\
\ public {0}() {}
> 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.
Good idea. If @hidden doesn't work then we can eat the trace entries.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179518999
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179528956
PR Review Comment: https://git.openjdk.org/jdk/pull/13689#discussion_r1179517981
More information about the compiler-dev
mailing list