Back to Intellij Community

RedundantFileCreation

java/java-impl/resources/inspectionDescriptions/RedundantFileCreation.html

2025.3-rc-2395 B
Original Source

Reports redundant File creation in one of the following constructors when only String path can be used: FileInputStream, FileOutputStream, FileReader, FileWriter, PrintStream, PrintWriter, Formatter.

Example:

InputStream is = new FileInputStream(new File("in.txt"));

After quick-fix is applied:

InputStream is = new FileInputStream("in.txt");

New in 2020.3