On Tue, 6 Jan 2026 18:25:50 GMT, Phil Race <[email protected]> wrote: >> The problem is that Boolean will be a value type in the future (Project >> Valhalla) >> and so it can't be the referent of a Reference. >> >> In this code, the abstract class that creates the Reference accepts a >> generic type so isn't in control of what it receives. >> >> The concrete class that extends the generic class has no idea what the super >> class implementation does, >> so has no way to know that it might do something that is invalid for a >> value type. >> >> That's an interesting observation for Valhalla (that the code that does >> something inappropriate for a value type >> isn't the source of the value type) but I don't think we need to be concerned >> about that here because we can see reasons to do this anyway. >> >> The specific classes exist because a nominal singleton for the VM may need >> to be private to an AppContext. >> This is a concept from applets but also from webstart where we have a >> single JVM that may be running code >> from different origins that needs to be partitioned and sand boxed. >> >> This concept is obsolete now as applets and webstart are no longer >> supported, and the Security Manager >> is disabled, further undermining any way to support partitioning. >> >> This specific case of a Boolean created from the value of a Java System >> Property looks like it never needed >> this partitioning, so the minimal fix is to stop using RecyclableSingleton >> for it, and just cache the value of that. >> >> The next level of fix is to note that since AppContext is obsolete, there >> is no need for RecyclableSingleton >> to use AppContext specific values, making RecyclableSingleton just a lazy >> initialization mechanism for the singleton. >> >> Given that removing the obsolete AppContext is on the TBD list - and some >> JDK components have already >> removed per-AppContext code - and we'd probably come back to this in JDK 25 >> anyway it seems best >> to get it over with. >> >> That does mean that one other place in sun.awt.ImageCache needed to be >> updated too. >> >> Also one test that explicitly checked that AppContexts were used for UI >> instances is obsolete and removed. >> >> Note that RecyclableSingleton also offers some lazy initialisation benefit, >> and is widely used in Aqua, >> so going further and removing that probably isn't something we want to do at >> all, and certainly not here. > > Phil Race has updated the pull request incrementally with one additional > commit since the last revision: > > 8336654
Marked as reviewed by serb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/22868#pullrequestreview-3637285154
