mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
Inspection reports multiple java.io.File attribute calls in a row. Attribute calls: - lastModified - isFile - isDirectory - length It suggests replacing them with a single attributes extraction using java.nio.file.Files.readAttributes method GitOrigin-RevId: cd2f93645aab9a4cba2e1f87e05b431f0d21ee50
15 lines
494 B
Java
15 lines
494 B
Java
// "Replace with bulk 'Files.readAttributes' call" "true"
|
|
import java.io.*;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.attribute.BasicFileAttributes;
|
|
|
|
class Foo {
|
|
boolean printDirectory(File file) {
|
|
try {
|
|
BasicFileAttributes basicFileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
|
|
return basicFileAttributes.isDirectory() && basicFileAttributes.isRegularFile();
|
|
throw new IOException("");
|
|
} catch (IOException e) {
|
|
}
|
|
}
|
|
} |