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.

src/java.base/share/classes/java/math/BigInteger.java line 1276:

> 1274:          * on demand.
> 1275:          */
> 1276:         BigInteger[][] powerCache = new 
> BigInteger[Character.MAX_RADIX+1][];

Using a different local name will avoid the shadowing and make it more obvious 
that the initialization is being deliberately being done before the assignment 
to a volatile.

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

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

Reply via email to