RFR: 8290079: Reduce interaction with volatile in static initializer of BigInteger
Roger Riggs
rriggs at openjdk.org
Wed Jul 13 15:04:05 UTC 2022
On Mon, 11 Jul 2022 12:41:48 GMT, Сергей Цыпанов <duke at 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
More information about the core-libs-dev
mailing list