On Tue, 16 Apr 2024 13:26:43 GMT, Jan Lahoda <[email protected]> wrote:
>> src/java.base/share/native/libjli/java.c line 419:
>>
>>> 417: invokeInstanceMainWithArgs(JNIEnv *env, jclass mainClass, jobjectArray
>>> mainArgs) {
>>> 418: jmethodID constructor = (*env)->GetMethodID(env, mainClass,
>>> "<init>", "()V");
>>> 419: CHECK_EXCEPTION_FAIL();
>>
>> Shouldn't this also not be checked until you know you have an instance
>> method?
>
> You mean to first check whether the method exists, and only then try to
> lookup the constructor? Not sure if that has observable effects, but I can do
> that.
>
> I missed [JDK-8329581](https://bugs.openjdk.org/browse/JDK-8329581) before,
> my plan is to adjust this "check for exception and clear it" check to only
> work for `NoSuchMethodError`, and let the exception pass for any other
> exception.
Yes that is what I meant. If the main method is static then the class need not
have any such constructor (unless that is part of the spec for this
functionality?).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18753#discussion_r1568370439