Make finalize() overrides protected

Proprietary

Changes a public override of Object#finalize() to protected, the visibility Object gives it, so that code outside the class hierarchy cannot call it. Only the garbage collector should. The method is left public when it overrides a public finalize() of a supertype or an interface, which it cannot narrow, when a subclass or an intersection type inherits it to implement an interface's finalize(), and when anything in the repository calls finalize() on its class or a subclass, or calls a finalize() whose type is not known. Interfaces, and test sources, are not changed.

io.moderne.staticanalysis.MakeFinalizeProtected
mod run . --recipe=io.moderne.staticanalysis.MakeFinalizeProtected

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.