On Wed, 26 Aug 2026 11:44:14 GMT, ExE Boss <[email protected]> wrote: >>> Personally, I’d use a sealed interface with a strong and weak >>> implementation instead >> >> That seems cleaner than the option I had considered (and Andy also >> mentioned) to eliminate the extra field. I prototyped it using an abstract >> class, which I like better than an interface for this case, so I might go >> with it. >> >> I opted to keep it simple to minimize the changes (for example, there is no >> need for the Holder class and I dispensed with the annotations). > >> I prototyped it using an abstract class, which I like better than an >> interface for this case, so I might go with it. > > That can’t use `extends WeakReference`
Ah, good point. And having `WeakImpl` extend `WeakReference` would eliminate a second object for each reference wrapper (and a level of indirection on the get call). ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/2250#discussion_r3863432459
