Why is almost everything in the API final

Tom Eugelink tbee at tbee.org
Mon Sep 2 22:16:06 PDT 2013

On 2013-09-02 21:01, Richard Bair wrote:
> you have to think about the combinations of all things allowed by a developer.

Since it is impossible to think of and design upfront for all possible usages, and impossible to write error free code, I'm not sure I agree with the approach chosen. Immutability yes, final... Not so much. Because Swing was not final, it allowed for its users to fix and improve a lot of things (SwingX), while still using the improved class like it were the original component, and thus still be able to use other people's code. I've already experienced the amount of additional work that needs to do be done by reuse instead of inheritance in JavaFX. My impression is that if you're using a lot of final, than more interfaces are required in order to allow the 'impersonation' of classes (for a lack of a better word).

AFAIK there was never a framework that used final a lot, so time will tell if the choice was right. Swing and the JDK made it this far. But I'm suspecting the choice may have been made motivated more from the perspective of the developers of the framework (a few people) and not as much from the users (many people). We'll see if, when serious issues are found, if they can be patched outside of the main code. Or if people are able to modify behavior enough to match their need, or need to write stuff from scratch. And if this out weighs the breaking compatibility issue.

The truth probably is somewhere in the middle.

More information about the openjfx-dev mailing list