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:
http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014767.html
It appears that there are no constraitns and Doug Lea mentions in
http://cs.oswego.edu/pipermail/concurrency-interest/2015-December/014770.html
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