Inspectopedia Help

Redundant 'close()'

Reports unnecessary calls to close() at the end of a try-with-resources block and suggests removing them.

Example:

try(MyAutoCloseable ac = new MyAutoCloseable()) { foo(); ac.close(); }

After the quick-fix is applied:

try(MyAutoCloseable ac = new MyAutoCloseable()) { foo(); }

New in 2018.1

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023