3 ms·
> And of course there is always some piece of code that depends on finalizers to close some resource [...] I don't think anyone should use finalizers in Java.
by Tainnor 5y ago
> And of course there is always some piece of code that depends on finalizers to close some resource [...]
I don't think anyone should use finalizers in Java. It's been deprecated since Java 9 and even before that, it was widely considered a bad practice.
- oriolid 5y agoI don't think anyone should use finalizers in Java either, but it hasn't stopped anyone from doing that.
- Tainnor 5y agoThere are footguns in every language. There are certainly more footguns in C, which you're trying to advocate for, if I understand correctly (although I'm really not sure what your point is). FWIW, I haven't ever seen anyone use finalize() in Java. I don't doubt that it happens occasionally, but you can't blame a language for some of its users being incompetent.
- oriolid 5y agoI'm not advocating C for anything except low-level embedded but even there I think we could do better. I'm not sure what would be the optimal language for writing web backends but I'm convinced that we could do better than Java. I could even go as far as claiming that C# is a lot like Java with some of the worst parts fixed.
- pjmlp 5y agoIn the next LTS release it won't matter, as they won't be around any longer. https://openjdk.java.net/jeps/421 https://openjdk.java.net/jeps/421