API REVIEW: RT-23888, Make PopupFeatures and PromptData final

Randahl Fink Isaksen randahl at rockit.dk
Fri Aug 31 06:22:55 PDT 2012

In your own private projects, adding final to a class is no risk, since you can change it the minute you realise that, after all, you needed to subclass.

In a general purpose and open source project with thousands of users and many different types of target applications, using final is a huge risk.

My project has been struggling with the improper use of final classes in JavaFX several times. We are developing a framework based on JavaFX, and being able to extend JavaFX classes is absolutely necessary, in order to add more features.

Take a look at these issues to see how previous mistakes have affected application and framework development for us (I am sure there are more issues if you do your own search):

To this day both Text and WebView are *still* declared final, and it has cost my project many hours of ugly work-around coding. 

I sincerely hope that no other classes are made final in this framework. It is an absolute disaster to third party framework development.


On Aug 31, 2012, at 15:03 , Tom Eugelink <tbee at tbee.org> wrote:

> All I can say is that I hate final classes. "Not meant" does not mean "no one ever wants to".
> What is the gain of making them final and what is the loss of not making them final?
> Tom
> On 2012-08-31 14:59, Peter Zhelezniakov wrote:
>> Hello,
>> There are two helper classes in javafx.scene.web package: PopupFeatures
>> and PromptData. They are not meant to be extended by developers, so I
>> hereby propose making them final, i.e.:
>> public final class PopupFeatures {
>>     public final boolean hasMenu();
>>     public final boolean hasStatus();
>>     public final boolean hasToolbar();
>>     public final boolean isResizable();
>> }
>> public final class PromptData {
>>     public PromptData(String message, String defaultValue);
>>     public final String getMessage();
>>     public final String getDefaultValue();
>> }
>> Thanks!

More information about the openjfx-dev mailing list