Fixes after code review: IDEA-249165

GitOrigin-RevId: db35ebb920618b5e2105715406c1e24eb50bb71a
This commit is contained in:
Andrey.Cherkasov
2020-09-08 07:31:16 +00:00
committed by intellij-monorepo-bot
parent e7d0dd4021
commit 080b533383
15 changed files with 276 additions and 78 deletions
@@ -0,0 +1,40 @@
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Formatter;
import java.util.Locale;
class Main {
private static String getSomePathname() {
return "Some pathname";
}
public void main(String[] args) throws IOException {
new FileOutputStream("in.txt", false);
new FileReader("in.txt", Charset.defaultCharset());
new FileWriter("in.txt", true);
new FileWriter("in.txt", Charset.defaultCharset());
new FileWriter("in.txt", Charset.defaultCharset(), false);
new PrintStream("in.txt", StandardCharsets.UTF_16.displayName());
new PrintStream("in.txt", Charset.defaultCharset());
new PrintWriter("in.txt", StandardCharsets.UTF_16.displayName());
new PrintWriter("in.txt", StandardCharsets.UTF_16.displayName());
new Formatter("in.txt", StandardCharsets.UTF_16.displayName());
new Formatter("in.txt", StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter("in.txt", Charset.defaultCharset(), Locale.GERMAN);
new FileOutputStream(getSomePathname(), false);
new FileReader(getSomePathname(), Charset.defaultCharset());
new FileWriter(getSomePathname(), true);
new FileWriter(getSomePathname(), Charset.defaultCharset());
new FileWriter(getSomePathname(), Charset.defaultCharset(), false);
new PrintStream(getSomePathname(), StandardCharsets.UTF_16.displayName());
new PrintStream(getSomePathname(), Charset.defaultCharset());
new PrintWriter(getSomePathname(), StandardCharsets.UTF_16.displayName());
new PrintWriter(getSomePathname(), StandardCharsets.UTF_16.displayName());
new Formatter(getSomePathname(), StandardCharsets.UTF_16.displayName());
new Formatter(getSomePathname(), StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter(getSomePathname(), Charset.defaultCharset(), Locale.GERMAN);
}
}
@@ -1,15 +1,15 @@
// "Fix all 'Redundant file creation' problems in file" "true"
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.util.Formatter;
class Main {
public main(String[] args) {
InputStream is = new FileInputStream("1.txt");
OutputStream os = new FileOutputStream("2.txt");
FileReader fr = new FileReader("3.txt");
FileWriter fw = new FileWriter("4.txt");
PrintStream ps = new PrintStream("5.txt");
PrintWriter pw = new PrintWriter("6.txt");
Formatter f = new Formatter("7.txt");
public void main(String[] args) throws IOException {
new FileInputStream("in.txt");
new FileOutputStream("in.txt");
new FileReader("in.txt");
new FileWriter("in.txt");
new PrintStream("in.txt");
new PrintWriter("in.txt");
new Formatter("in.txt");
}
}
@@ -1,4 +1,4 @@
// "Fix all 'Redundant file creation' problems in file" "true"
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.util.Formatter;
@@ -7,13 +7,13 @@ class Main {
return "Some pathname";
}
public main(String[] args) {
InputStream is = new FileInputStream(getSomePathname());
OutputStream os = new FileOutputStream(getSomePathname());
FileReader fr = new FileReader(getSomePathname());
FileWriter fw = new FileWriter(getSomePathname());
PrintStream ps = new PrintStream(getSomePathname());
PrintWriter pw = new PrintWriter(getSomePathname());
Formatter f = new Formatter(getSomePathname());
public void main(String[] args) throws IOException {
new FileInputStream(getSomePathname());
new FileOutputStream(getSomePathname());
new FileReader(getSomePathname());
new FileWriter(getSomePathname());
new PrintStream(getSomePathname());
new PrintWriter(getSomePathname());
new Formatter(getSomePathname());
}
}
@@ -0,0 +1,43 @@
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Formatter;
import java.util.Locale;
class Main {
private static String getSomePathname() {
return "Some pathname";
}
public void main(String[] args) throws IOException {
new FileInputStream((("in.txt")));
new FileOutputStream((("in.txt")));
new FileReader((("in.txt")));
new FileWriter((("in.txt")));
new PrintStream((("in.txt")));
new PrintWriter((("in.txt")));
new Formatter((("in.txt")));
new FileInputStream(((getSomePathname())));
new FileOutputStream(((getSomePathname())));
new FileReader(((getSomePathname())));
new FileWriter(((getSomePathname())));
new PrintStream(((getSomePathname())));
new PrintWriter(((getSomePathname())));
new Formatter(((getSomePathname())));
new FileOutputStream((getSomePathname()), false);
new FileReader((getSomePathname()), Charset.defaultCharset());
new FileWriter((getSomePathname()), true);
new FileWriter((getSomePathname()), Charset.defaultCharset());
new FileWriter((getSomePathname()), Charset.defaultCharset(), false);
new PrintStream((getSomePathname()), StandardCharsets.UTF_16.displayName());
new PrintStream((getSomePathname()), Charset.defaultCharset());
new PrintWriter((getSomePathname()), StandardCharsets.UTF_16.displayName());
new PrintWriter((getSomePathname()), StandardCharsets.UTF_16.displayName());
new Formatter((getSomePathname()), StandardCharsets.UTF_16.displayName());
new Formatter((getSomePathname()), StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter((getSomePathname()), Charset.defaultCharset(), Locale.GERMAN);
}
}
@@ -0,0 +1,40 @@
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Formatter;
import java.util.Locale;
class Main {
private static String getSomePathname() {
return "Some pathname";
}
public void main(String[] args) throws IOException {
new FileOutputStream(new Fi<caret>le("in.txt"), false);
new FileReader(new File("in.txt"), Charset.defaultCharset());
new FileWriter(new File("in.txt"), true);
new FileWriter(new File("in.txt"), Charset.defaultCharset());
new FileWriter(new File("in.txt"), Charset.defaultCharset(), false);
new PrintStream(new File("in.txt"), StandardCharsets.UTF_16.displayName());
new PrintStream(new File("in.txt"), Charset.defaultCharset());
new PrintWriter(new File("in.txt"), StandardCharsets.UTF_16.displayName());
new PrintWriter(new File("in.txt"), StandardCharsets.UTF_16.displayName());
new Formatter(new File("in.txt"), StandardCharsets.UTF_16.displayName());
new Formatter(new File("in.txt"), StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter(new File("in.txt"), Charset.defaultCharset(), Locale.GERMAN);
new FileOutputStream(new File(getSomePathname()), false);
new FileReader(new File(getSomePathname()), Charset.defaultCharset());
new FileWriter(new File(getSomePathname()), true);
new FileWriter(new File(getSomePathname()), Charset.defaultCharset());
new FileWriter(new File(getSomePathname()), Charset.defaultCharset(), false);
new PrintStream(new File(getSomePathname()), StandardCharsets.UTF_16.displayName());
new PrintStream(new File(getSomePathname()), Charset.defaultCharset());
new PrintWriter(new File(getSomePathname()), StandardCharsets.UTF_16.displayName());
new PrintWriter(new File(getSomePathname()), StandardCharsets.UTF_16.displayName());
new Formatter(new File(getSomePathname()), StandardCharsets.UTF_16.displayName());
new Formatter(new File(getSomePathname()), StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter(new File(getSomePathname()), Charset.defaultCharset(), Locale.GERMAN);
}
}
@@ -1,15 +1,15 @@
// "Fix all 'Redundant file creation' problems in file" "true"
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.util.Formatter;
class Main {
public main(String[] args) {
InputStream is = new FileInputStream(new Fi<caret>le("1.txt"));
OutputStream os = new FileOutputStream(new File("2.txt"));
FileReader fr = new FileReader(new File("3.txt"));
FileWriter fw = new FileWriter(new File("4.txt"));
PrintStream ps = new PrintStream(new File("5.txt"));
PrintWriter pw = new PrintWriter(new File("6.txt"));
Formatter f = new Formatter(new File("7.txt"));
public void main(String[] args) throws IOException {
new FileInputStream(new Fi<caret>le("in.txt"));
new FileOutputStream(new File("in.txt"));
new FileReader(new File("in.txt"));
new FileWriter(new File("in.txt"));
new PrintStream(new File("in.txt"));
new PrintWriter(new File("in.txt"));
new Formatter(new File("in.txt"));
}
}
@@ -1,4 +1,4 @@
// "Fix all 'Redundant file creation' problems in file" "true"
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.util.Formatter;
@@ -7,13 +7,13 @@ class Main {
return "Some pathname";
}
public main(String[] args) {
InputStream is = new FileInputStream(new Fi<caret>le(getSomePathname()));
OutputStream os = new FileOutputStream(new File(getSomePathname()));
FileReader fr = new FileReader(new File(getSomePathname()));
FileWriter fw = new FileWriter(new File(getSomePathname()));
PrintStream ps = new PrintStream(new File(getSomePathname()));
PrintWriter pw = new PrintWriter(new File(getSomePathname()));
Formatter f = new Formatter(new File(getSomePathname()));
public void main(String[] args) throws IOException {
new FileInputStream(new Fi<caret>le(getSomePathname()));
new FileOutputStream(new File(getSomePathname()));
new FileReader(new File(getSomePathname()));
new FileWriter(new File(getSomePathname()));
new PrintStream(new File(getSomePathname()));
new PrintWriter(new File(getSomePathname()));
new Formatter(new File(getSomePathname()));
}
}
@@ -0,0 +1,43 @@
// "Fix all 'Redundant File object creation' problems in file" "true"
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Formatter;
import java.util.Locale;
class Main {
private static String getSomePathname() {
return "Some pathname";
}
public void main(String[] args) throws IOException {
new FileInputStream((new Fi<caret>le(("in.txt"))));
new FileOutputStream((new File(("in.txt"))));
new FileReader((new File(("in.txt"))));
new FileWriter((new File(("in.txt"))));
new PrintStream((new File(("in.txt"))));
new PrintWriter((new File(("in.txt"))));
new Formatter((new File(("in.txt"))));
new FileInputStream((new File((getSomePathname()))));
new FileOutputStream((new File((getSomePathname()))));
new FileReader((new File((getSomePathname()))));
new FileWriter((new File((getSomePathname()))));
new PrintStream((new File((getSomePathname()))));
new PrintWriter((new File((getSomePathname()))));
new Formatter((new File((getSomePathname()))));
new FileOutputStream((new File(getSomePathname())), false);
new FileReader((new File(getSomePathname())), Charset.defaultCharset());
new FileWriter((new File(getSomePathname())), true);
new FileWriter((new File(getSomePathname())), Charset.defaultCharset());
new FileWriter((new File(getSomePathname())), Charset.defaultCharset(), false);
new PrintStream((new File(getSomePathname())), StandardCharsets.UTF_16.displayName());
new PrintStream((new File(getSomePathname())), Charset.defaultCharset());
new PrintWriter((new File(getSomePathname())), StandardCharsets.UTF_16.displayName());
new PrintWriter((new File(getSomePathname())), StandardCharsets.UTF_16.displayName());
new Formatter((new File(getSomePathname())), StandardCharsets.UTF_16.displayName());
new Formatter((new File(getSomePathname())), StandardCharsets.UTF_16.displayName(), Locale.ENGLISH);
new Formatter((new File(getSomePathname())), Charset.defaultCharset(), Locale.GERMAN);
}
}