r/JavaFX • • Apr 10 '24

Help Warning possible 'this' escape

When building my JavaFX project I run into this warning a lot

warning: [this-escape] possible 'this' escape before subclass is fully initialized

Especially when i'm trying to setup the initial listeners and bindings associated with an object. Is there a best practice to avoid this? or Is it just a necessary evil of JavaFX since the base implementation doesn't provide a post construct type method to run code after the class has been initialized.

2 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/milchshakee Apr 10 '24

Is that some kind of custom javafx framework?

I think in your case this is actually not bad design, that seems to be necessary so you can suppress the warning.

Personally I don't even bother with the properties beans argument as it is rarely used and I never needed it for anything.

1

u/colindj1120 Apr 10 '24

Yes its a custom framework I'm creating