On Mon, 11 Jul 2022 12:41:48 GMT, Сергей Цыпанов <d...@openjdk.org> wrote:

> `BigInteger.powerCache` is volatile and should be assigned only once in 
> static initializer.

Usually yes, but since a static initializer is executed by at most one thread 
by using a locking protocol before any other static code is ever executed, the 
runtime _could_ (but I'm not sure it it really does) treat the volatile in the 
for loop as a local.
But I would approve your change because it makes this more explicit.

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

PR: https://git.openjdk.org/jdk/pull/9451

Reply via email to