On Mon, 12 Oct 2026 21:32:43 GMT, Michael Strauß <[email protected]> wrote:
>> Yes, it was done as as to minimize the diff as a part of a larger PR. It is >> probably ok since it's a slightly heavier variant of a static initializer >> (one extra allocation, I think). I just don't want someone looking at this >> code and saying, "oh cool idea, let's do it everywhere". > > The advantage of this solution is that it allows us to initialize a constant > from one single expression. Keep in mind that this code is only run once. > This means it's never C2-compiled, so cold-start class loading and bytecode > interpretation cost totally dominates everything else. > > If we do want to use it in other places, we could test whether a small > utility method looks nicer in code (something like `static final boolean > myConst = Utils.initConst(() -> ...calculate the value...)`); Maybe we just wait and use [Lazy Constants](https://openjdk.org/jeps/526) eventually. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2299#discussion_r4291081236
