[doc] AutoClosable -> AutoCloseable
This commit is contained in:
@@ -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.
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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[
|
||||
|
Reference in New Issue
Block a user