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

Andy Goryachev angorya at openjdk.org
Tue Jun 3 16:29:57 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.

To clarify, the difference is as follows:
- on per-class basis, we are saving a few kilobytes by replacing a bunch of class data structures with one (with two, one for `Scene` and one for `Window`)
- on per-instance basis, we are adding 2 pointers multiplied by the number of properties (39 for `Scene`), multiplied by the number of instances of `Scene`/`Windows`.

So depending on the application, it might be a net win for a small app, or more memory used when the app devs create hundreds of windows and keep them hidden (I've seen those).

Still, I think it's a good change.

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

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


More information about the openjfx-dev mailing list