Review Finding: Check for type java.nio.FileSystems

This commit is contained in:
lukasgraef 2024-09-30 20:13:01 +02:00
parent ddb1eb8dd8
commit 39b8bdf171

View File

@ -503,7 +503,7 @@ public class CloseResourceRule extends AbstractJavaRule {
private boolean isDefaultFileSystem(ASTVariableId varId) {
@Nullable
ASTExpression initializer = varId.getInitializer();
return initializer != null && initializer.getText().contentEquals("FileSystems.getDefault()");
return initializer != null && InvocationMatcher.parse("java.nio.file.FileSystems#getDefault()").matchesCall(initializer);
}
private boolean isVariableSpecifiedInTryWithResource(ASTVariableId varId, ASTTryStatement tryWithResource) {