RFR: 8358255: Factor out boilerplate code of EventHandler properties in Scene and Window

Nir Lisker nlisker at openjdk.org
Tue Jun 3 16:12:59 UTC 2025


On Sun, 1 Jun 2025 21:42:17 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> `EventHandler` property implementations in `Scene` and `Window` use anonymous classes derived from `ObjectPropertyBase`. We can remove about 650 lines of boilerplate code by using a common property class instead.

I've tried to do something similar for controls by replacing a lot of the anonymous classes with concrete ones. I can't find the issue/discussion right now, but Kevin measured a non-negligible increase in memory usage. I assume it's because constant folding is doable for the constants in the methods of the anonymous class, but not for the final fields in the concrete property (because they are not really final when considering reflection).

Because an application doesn't have a lot of windows and scenes, it's possible that these changes won't have detrimental effects, but I suggest measuring.

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

PR Comment: https://git.openjdk.org/jfx/pull/1819#issuecomment-2936156979


More information about the openjfx-dev mailing list