3 ms·
Final making software less extensive is a red herring. The JEP is about final for fields, not final for classes. Nothing changes regarding the latter. It merely
by samus 2y ago
Final making software less extensive is a red herring. The JEP is about final for fields, not final for classes. Nothing changes regarding the latter. It merely deprecates facilities that enable programmers to ignore the explicitly stated intentions of other developers.
- Supermancho 2y ago> enable programmers to ignore the explicitly stated intentions of other developers You say ignore. This is unnecessarily pejorative. You mean "change". Software does not care about explicit intentions or who is leveraging it. Overriding is one of the essential methods of extending software.
- pron 2y agoJava allows you to freely change any decision made by any author of any library you use. None of that ability has been taken away. However, changing other code (and potentially changing the assumptions on which it was built) shouldn't be as easy as using it in a way that preserves its assumptions. If it were just as easy, you could accidentally break other code's assumptions. In some situations, all that's required of you is merely to declare that you indeed intend to change some other code's assumptions; in more involved situations (e.g. a library method computes the sum of its argument and you want to change it to compute the product) the work is more involved, but you can still do it relatively easily. What we have blocked is the ability of a library to change the assumptions of another library or of the application's without the application knowing about it. A library absolutely must not be allowed to do that while hiding that from the application.