RFR: 8346132: fallbacklinker.cpp failed compilation due to unused variable
Jorn Vernee
jvernee at openjdk.org
Wed Dec 18 12:01:56 UTC 2024
On Wed, 18 Dec 2024 07:37:49 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> Agree with David here. Generally I comment out unused code errors rather than outright remove them for this very reason. Also fallbackLinker doesn't seem to be a C++ file?
>
> How about the following?
>
>
> jint result = (*VM)->AttachCurrentThreadAsDaemon(VM, (void**) &env, NULL);
> if (result != JNI_OK) {
> fprintf(stderr, "do_upcall trying to attach thread returned %d", result);
> return;
> }
We can not return to native code here in case of an error. We should terminate the process instead.
The same should really also be done in case the call to `CallStaticVoidMethod` below throws an exception. This was a leftover from the initial implementation of this code that apparently fell through the cracks.
Ideally we should also add a test for that so... I suggest just removing the unused variable in this PR for now, to get this to compile, and then I can file a followup issue to address the lack of error handling.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22799#discussion_r1890121853
More information about the core-libs-dev
mailing list