On Sat, 25 Feb 2023 18:16:07 GMT, Brett Okken <[email protected]> wrote:

>> Andrey Turbanov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   8303213: Avoid AtomicReference in TextComponentPrintable
>>   
>>   read volatile field only once
>
> src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java 
> line 343:
> 
>> 341:                     public FontMetrics getFontMetrics(Font font) {
>> 342:                         return (frc == null)
>> 343:                             ? super.getFontMetrics(font)
> 
> Should the be set to local variable to avoid 2 volatile reads?

I agree, it's better to read once.

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

PR: https://git.openjdk.org/jdk/pull/12018

Reply via email to