On Fri, 6 Nov 2026 08:13:34 GMT, Prasanta Sadhukhan <[email protected]>
wrote:
>> src/java.desktop/macosx/native/libosxapp/JNIUtilities.h line 55:
>>
>>> 53:
>>> 54: #define GET_CLASS_ONLY(dst_var, cls) \
>>> 55: dispatch_once(&dst_var##_once, ^{ \
>>
>> This change from a test for NULL to dispatch_once is the fix. The rest is
>> just to support it.
>
> There seems to be a deviation from previous. code...
> If FindClass or NewGlobalRef fails, dst_var = NULL but block returns normally
> so dispatch_once marks initiization complete but on subsequent call,
> dispatch_once skips initialization and CHECK_NULL returns again so it seems
> transient failure can leave the cache unavailable for rest of the process
>
> Previously the block is done inside if(dst_var == NULL) check so it would
> have again be retried
The previous NULL check wasn't to support a re-try. It was to avoid
re-initialisation.
And relying on that NULL check for initialization is largely the root of this
bug.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33481#discussion_r4498209146