On Tue, 15 Nov 2022 18:16:20 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> 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.

That is my whole point. We have two paths - one for Skin classes and other for 
generic usage.

Approving the PR as you have added a comment regarding `ListenerHelper` class's 
current scope being limited to Skins. We may need to revisit the suggestion of 
having a derived class in future.

-------------

PR: https://git.openjdk.org/jfx/pull/908

Reply via email to