On Tue, 15 Nov 2022 06:17:21 GMT, Ajit Ghaisas <[email protected]> wrote:
>> Right, there is no way the accessor can be null, since it is initialized at >> class load time in the static initializer, We do this in many other places >> (e.g., Node.java). > > The `accessor` cannot be null **only if** it is used from *Skins. > In the current form, as we provide a no-argument public constructor, it is > possible to create an object of `ListenerHelper` without calling setAccessor. > Many unit tests added as part of this PR create such `ListenerHelper` objects. The `accessor` is used **only** if used from *Skins, meaning to get it from a Skin, one needs to invoke `get(SkinBase)` method, and it's magically not a null there! It is perfectly fine to create an instance of ListenerHelper using the constructor. The `accessor` will be null, of course, but it's ok because it will never be used until one calls `get(SkinBase)` ... and see above. ------------- PR: https://git.openjdk.org/jfx/pull/908
