[PATCH] remove redundant initialization of volatile fields with default values

Sean Mullan sean.mullan at oracle.com
Thu Aug 13 17:20:20 UTC 2020

On 8/13/20 9:04 AM, Сергей Цыпанов wrote:
> Hi,
> I don't have account in JBS, so I cannot file an issue.
> Previously when I submitted patches via core-libs-dev mailing list previleged users
> filed the issues and created web-reviews.
> I think this should be a subtask of https://bugs.openjdk.java.net/browse/JDK-6736490, there's
> already one I've mentioned in previous mail: https://bugs.openjdk.java.net/browse/JDK-8145680

Done: see https://bugs.openjdk.java.net/browse/JDK-8251548


> Regards,
> Sergey Tsypanov
> 13.08.2020, 14:05, "Sean Mullan" <sean.mullan at oracle.com>:
>> On 8/13/20 7:04 AM, Сергей Цыпанов wrote:
>>>   Hello,
>>>   previously I've sent an email regarding removal of redundant assignments if default values to volatile fields, see
>>>   https://mail.openjdk.java.net/pipermail/security-dev/2020-June/022137.html
>>>   There was a concern whether it's completely safe to remove those assignments from JMM point of view, see
>>>   https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-June/067341.html
>>>   Recently I've found a thread in concurrency-interest mailing list where Aleksey Shiplive tried to find a constraint
>>>   agians such removal: https://urldefense.com/v3/__http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014767.html__;!!GqivPVa7Brio!I4TMi9HPzckS0_w9Qmgw0-kGArRRuctFvBSnpthDRPaGGqgvl9yyrjVHboPdHMd6$
>>>   It appears that there are no constraitns and Doug Lea mentions in
>>>   https://urldefense.com/v3/__http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014770.html__;!!GqivPVa7Brio!I4TMi9HPzckS0_w9Qmgw0-kGArRRuctFvBSnpthDRPaGGqgvl9yyrjVHbvX4nrL2$
>>>   that "there is never any reason to explicitly initialize fields to 0/0.0/false/null"
>>>   Also there we similar code changes in java.base before:
>>>   - https://bugs.openjdk.java.net/browse/JDK-6736490
>>>   - https://bugs.openjdk.java.net/browse/JDK-8035284
>>>   - https://bugs.openjdk.java.net/browse/JDK-8145680
>>>   So I think now we can accept the patch as the changes appear to be safe.
>> Ok, it seems like a good change. Are you able to file a JBS issue for
>> this? After that you can request a formal code review.
>> Thanks,
>> Sean

More information about the security-dev mailing list