[doc] AutoClosable -> AutoCloseable

This commit is contained in:
Andrey Bozhko
2023-09-06 16:50:16 +00:00
parent 512d6cbb8d
commit ba35bdc6bc
3 changed files with 5 additions and 5 deletions

View File

@@ -977,7 +977,7 @@ Ensure that resources (like `java.sql.Connection`, `java.sql.Statement`, and `ja
and any subtype of `java.lang.AutoCloseable`) are always closed after use.
Failing to do so might result in resource leaks.
Note: It suffices to configure the super type, e.g. `java.lang.AutoClosable`, so that this rule automatically triggers
Note: It suffices to configure the super type, e.g. `java.lang.AutoCloseable`, so that this rule automatically triggers
on any subtype (e.g. `java.io.FileInputStream`). Additionally specifying `java.sql.Connection` helps in detecting
the types, if the type resolution / auxclasspath is not correctly setup.

View File

@@ -182,13 +182,13 @@ public class TryWithResources {
<code><![CDATA[
public class TryWithResources {
public void run() {
var noAutoclosable = new Object() {
var noAutoCloseable = new Object() {
public void close() {}
};
try {
System.out.println(noAutocloseable);
System.out.println(noAutoCloseable);
} finally {
noAutoclosable.close();
noAutoCloseable.close();
}
}
}

View File

@@ -1133,7 +1133,7 @@ public class CloseResourceJMS {
</test-code>
<test-code>
<description>CloseResource for closable - ignored if the types do not contain AutoClosable</description>
<description>CloseResource for closable - ignored if the types do not contain AutoCloseable</description>
<rule-property name="types">java.sql.Connection,java.sql.Statement,java.sql.ResultSet</rule-property>
<expected-problems>0</expected-problems>
<code><![CDATA[