Two considerations
1) The class can already be extended, so do not mark it final or you may violate backward compatibility.
2) You do not want the class to be extended, so it should be marked final.
I think what you should do is extend the old class with a new class, mark the old class obsolete and declare the new class final. In the new class, you can add the @SuppressWarning tag to calm the stale message, after which you should get a clean compilation.
Code using the old class will receive a @Deprecated warning, but will still compile. Code using the new class will compile cleanly. Itβs a kind of βstrong offerβ for your users instead of a backward compatible break and is quite easy to fix for them, since the API is 100% compatible.
Zak
source share