One less (benign) race - and possibly more efficient, too :-)
If we really worry about the startup costs here, we could make it so
that the three Cache classes
themselves aren't loaded until someone actually has a need for them:
http://cr.openjdk.java.net/~redestad/scratch/coderresult_cache.00/
/Claes
On 2018-03-02 21:02, Xueming Shen wrote:
To follow Claes's suggestion to make the CoderResult.Cache.cache field
final and allocate early.
issue: https://bugs.openjdk.java.net/browse/JDK-8198966
webrev: http://cr.openjdk.java.net/~sherman/8198966/webrev/
Thanks,
-Sherman