Replace finalize method in java.io.FileInputStream and java.io.FileOutputStream

MSAL

The finalize method in java.io.FileInputStream and java.io.FileOutputStream is no longer available in Java SE 12 and later. The recipe replaces it with the close method.

org.openrewrite.java.migrate.RemovedFileIOFinalizeMethods
mod run . --recipe=org.openrewrite.java.migrate.RemovedFileIOFinalizeMethods

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

Recipe list

It runs these recipes, in this order.

  1. Change method name java.io.FileInputStream finalize() to close
  2. Change method name java.io.FileOutputStream finalize() to close