On Tue, 23 Feb 2021 16:13:21 GMT, liach <github.com+7806504+li...@openjdk.org> 
wrote:

>This shouldn't be a problem.

What do you mean by "this"? Double racy read?
There are 2 separate reads of fields. First can return non-null value, while 
second still can get `null`

> src/java.base/share/classes/java/lang/Runtime.java line 824:
> 
>> 822:                     VersionProps.pre(), VersionProps.build(),
>> 823:                     VersionProps.optional());
>> 824:             version = v;
> 
> Can't this just be `return version = new Version(...` than reassigning to a 
> local variable for no good?

It's matter of style. I've seen both styles are acceptable in JDK codebase. I 
personally prefer placing assigning each variable into separate lines.

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

PR: https://git.openjdk.java.net/jdk/pull/2691

Reply via email to