On Tue, 27 Jun 2023 14:11:41 GMT, Alan Bateman <al...@openjdk.org> wrote:
> What I suggest is to prepare the array only once (in the static block as it > is now), but have each class that use it encapsulate is own copy - obtained > from clone(). Surely 256 shorts is not so large that we can't have two arrays? I really wish we have frozen arrays, which are safely sharable like records. The closest we have right now is a final array with `@Stable`, which indicates array elements are lazy (any non-default value read can be treated as a constant by JIT); since this array is explicitly `@Stable final`, we can share it within the JDK like any other immutable objects. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14578#discussion_r1243822811