mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-03 11:47:50 +07:00
Inspection suggests conversions: 1. FileInputStream -> Files.newInputStream 2. FileOutputStream -> Files.newOutputStream in cases when FileInputStream can be replaced with InputStream. Also, it reuses path variable after conversion when possible (path variable should be effectively final). GitOrigin-RevId: 474dcaeeb5336fcc8330b4b3ed65d443042ecf2f
11 lines
324 B
Java
11 lines
324 B
Java
// "Replace with 'Files.newOutputStream'" "true"
|
|
import java.io.*;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
|
|
class Foo {
|
|
void test(String str, boolean b) {
|
|
try (OutputStream os = (b ? (Files.newOutputStream(Path.of("foo"))) : (Files.newOutputStream(Path.of(str))))) {
|
|
} catch (IOException e) {}
|
|
}
|
|
} |