RFR: 8210765: Remove finalize method in CStrike.java [v2]

Phil Race prr at openjdk.org
Thu Jul 31 19:49:54 UTC 2025


On Thu, 31 Jul 2025 04:10:37 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Phil Race has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8210765
>
> src/java.desktop/macosx/classes/sun/font/CStrike.java line 99:
> 
>> 97: 
>> 98:     public long getNativeStrikePtr() {
>> 99:         return nativeStrikePtr;
> 
> Any reason this check was removed?
> I see that initNativeStrikePtr will call createNativeStrikePtr which does this where there is no null check and it just returns what it gets so shouldn't we check it here?
> 
> 
> awtStrike = [AWTStrike awtStrikeForFont:awtFont tx:glyphTx invDevTx:invDevTx style:style aaStyle:aaStyle]; // autoreleased
> 
>     if (awtStrike)
>     {
>         CFRetain(awtStrike); // GC
>     }
> 
> JNI_COCOA_EXIT(env);
>     return ptr_to_jlong(awtStrike);

And if it is 0, what would you do ?
Previously 0 meant it hadn't yet been initialized. Now it is always initialized.

You'd need to return it anyway even it was zero.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26397#discussion_r2246246622


More information about the client-libs-dev mailing list