Inspectopedia Help

Redundant 'File' instance creation

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


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

After quick-fix is applied:

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

New in 2020.3

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023