1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Do not override `Object.finalize`.
Starting in JDK 18, the method is deprecated for removal, see
[JEP 421: Deprecate Finalization for Removal](https://openjdk.org/jeps/421).
The [Google Java Style Guide ยง6.4][style] states:
> It is extremely rare to override `Object.finalize`.
>
> Tip: Don't do it. If you absolutely must, first read and understand
> [Effective Java Item 8][ej3e-8], "Avoid finalizers and cleaners" very
> carefully, and then don't do it.
[ej3e-8]: https://books.google.com/books?id=BIpDDwAAQBAJ
[style]: https://google.github.io/styleguide/javaguide.html#s6.4-finalizers
|