File (File outsDir, Sdk jdk, @Nullable File current, String prefix) { String name = myTestName + prefix; File res = new File(outsDir, name + ".out"); if (current == null || res.exists()) { current = res; } JavaSdkVersion version = JavaSdkVersionUtil.getJavaSdkVersion(jdk); for (int feature = version.getMaxLanguageLevel().toJavaVersion().feature; feature > 6; feature--) { File outFile = new File(outsDir, name + ".jdk" + feature + ".out"); if (outFile.exists()) { current = outFile; break; } } return current; }