RFR: 8294809: ListenerHelper for managing and disconnecting listeners [v9]

Kevin Rushforth kcr at openjdk.org
Mon Nov 14 21:16:04 UTC 2022


On Mon, 14 Nov 2022 20:19:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ListenerHelper.java line 87:
>> 
>>> 85: 
>>> 86:     public static ListenerHelper get(SkinBase<?> skin) {
>>> 87:         return accessor.apply(skin);
>> 
>> `accessor` can be `null` and needs to be checked.
>
> I don't think this is the case.
> When this method is called, SkinBase class must be already loaded and resolved, that means it's static { } block, which sets the accessor, has been executed.  But just in case, I should move the static block in SkinBase, so we don't have any surprises.

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

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

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


More information about the openjfx-dev mailing list