On Fri, 20 Aug 2021 09:41:15 GMT, Сергей Цыпанов <github.com+10835776+stsypa...@openjdk.org> wrote:
> This is a continuation of > > - https://bugs.openjdk.java.net/browse/JDK-6736490 > - https://bugs.openjdk.java.net/browse/JDK-8035284 > - https://bugs.openjdk.java.net/browse/JDK-8145680 > - https://bugs.openjdk.java.net/browse/JDK-8251548 > > As mentioned in JDK-6736490: > > _An explicit initialization of a volatile class instance variable, such as > private volatile Object = null; or private volatile int scale = 0; is > unnecessary since the Java spec automatically initializes objects to null and > primitive type short, int, long, float and double to 0 and boolean to false. > Explicit initialization of volatile variable to a value the same as the > default implicit initialized value results in an unnecessary store and membar > operation._ This pull request has now been integrated. Changeset: ccbce107 Author: Sergey Tsypanov <sergei.tsypa...@yandex.ru> Committer: Jayathirth D V <j...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/ccbce107f299c3b1c444e819c1fda7ae3c4866b5 Stats: 54 lines in 28 files changed: 0 ins; 0 del; 54 mod 8272756: Remove unnecessary explicit initialization of volatile variables in java.desktop Reviewed-by: jdv, aivanov ------------- PR: https://git.openjdk.java.net/jdk/pull/5197