AutoCloseable instances which are not used in a try-with-resources statement, also known as
Automatic Resource Management.
This means that the "open resource before/in try, close in finally" style that had been used before
try-with-resources became available, is also reported.
This inspection is meant to replace all opened but not safely closed inspections when developing in Java 7 and higher.
Example:
private static void foo() throws IOException {
InputStream profile = Thread.currentThread().getContextClassLoader().getResourceAsStream("/someFile");
System.out.println(profile.read());
}
Use the following options to configure the inspection:
AutoCloseable that do not need to be closed and should be ignored by this inspection.
java.nio.file.Files methods lines(),
walk(), list() and find(),
even when java.util.stream.Stream is listed to be ignored.
These streams contain an associated I/O resource that needs to be closed.
AutoCloseable that should be ignored when called.
AutoCloseable if it is the result of a method call.
When this option is enabled, the results of factory methods will also be ignored.
AutoCloseable instance is passed as a method call argument.
If this option is enabled, the inspection assumes the resource is closed in the called method.
Method calls inside a finally block with 'close' in the name and an
AutoCloseable argument will not be ignored.