<Swing Dev> RFR: 8272756: Remove unnecessary explicit initialization of volatile variables in java.desktop
Alexey Ivanov
aivanov at openjdk.java.net
Mon Aug 23 13:11:29 UTC 2021
On Mon, 23 Aug 2021 06:35:34 GMT, Сергей Цыпанов <github.com+10835776+stsypanov at openjdk.org> wrote:
>> src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFIFD.java line 64:
>>
>>> 62: Set<Integer> tags = essentialTags;
>>> 63: if (tags == null) {
>>> 64: essentialTags = Set.of(
>>
>> What is the purpose of the local tags here?
>
> Looks like there's no purpose, `tags` is not used after assignment
Maybe it's kind of a protection from a race. Yet it's possible either way: another thread could see `essentialTags == null` before this one initialises the field.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5197
More information about the swing-dev
mailing list