-
Notifications
You must be signed in to change notification settings - Fork 29
Check that modern APIs are used #1342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
0365724
20fab0d
e591ac4
d18a5c2
86498e9
3d993fa
57f7b4a
24779e6
bd1ccf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| import org.junit.runners.model.InitializationError; | ||
|
|
||
| import java.io.File; | ||
| import java.nio.file.Path; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
|
|
@@ -33,8 +34,8 @@ public RootedSuite(Class<?> klass, List<Runner> runners) throws InitializationEr | |
| protected final File resolveTestDirectory() { | ||
| TestRootDirectory annotation = getTestClass().getAnnotation(TestRootDirectory.class); | ||
| if (annotation != null) { | ||
| return new File(annotation.value()); | ||
| return Path.of(annotation.value()).toFile(); | ||
| } | ||
| return new File("tests"); | ||
| return Path.of("tests").toFile(); | ||
|
Comment on lines
+37
to
+39
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,7 +85,7 @@ public class TestUtilities { | |||||||||
| * @return found files | ||||||||||
| */ | ||||||||||
| public static List<File> findNestedJavaTestFiles(String... dirNames) { | ||||||||||
| return findRelativeNestedJavaFiles(new File("tests"), dirNames); | ||||||||||
| return findRelativeNestedJavaFiles(Paths.get("tests").toFile(), dirNames); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /** | ||||||||||
|
|
@@ -96,7 +96,7 @@ public static List<File> findNestedJavaTestFiles(String... dirNames) { | |||||||||
| * @return found files | ||||||||||
| */ | ||||||||||
| public static List<File> findRelativeNestedJavaFiles(String parent, String... dirNames) { | ||||||||||
| return findRelativeNestedJavaFiles(new File(parent), dirNames); | ||||||||||
| return findRelativeNestedJavaFiles(Paths.get(parent).toFile(), dirNames); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| /** | ||||||||||
|
|
@@ -111,7 +111,7 @@ public static List<File> findRelativeNestedJavaFiles(File parent, String... dirN | |||||||||
|
|
||||||||||
| int i = 0; | ||||||||||
| for (String dirName : dirNames) { | ||||||||||
| dirs[i] = new File(parent, dirName); | ||||||||||
| dirs[i] = parent.toPath().resolve(dirName).toFile(); | ||||||||||
| ++i; | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -140,7 +140,7 @@ public static List<List<File>> findJavaFilesPerDirectory(File parent, String... | |||||||||
| List<List<File>> filesPerDirectory = new ArrayList<>(); | ||||||||||
|
|
||||||||||
| for (String dirName : dirNames) { | ||||||||||
| File dir = new File(parent, dirName).toPath().toAbsolutePath().normalize().toFile(); | ||||||||||
| File dir = parent.toPath().resolve(dirName).toAbsolutePath().normalize().toFile(); | ||||||||||
| if (dir.isDirectory()) { | ||||||||||
| filesPerDirectory.addAll(findJavaTestFilesInDirectory(dir)); | ||||||||||
| } else { | ||||||||||
|
|
@@ -168,8 +168,8 @@ public static List<List<File>> findJavaFilesPerDirectory(File parent, String... | |||||||||
| throw new BugInCF("test directory does not exist: %s", dir); | ||||||||||
| } | ||||||||||
| p = | ||||||||||
| new File(parent, allSystemPath.replace("/", File.separator)) | ||||||||||
| .toPath() | ||||||||||
| parent.toPath() | ||||||||||
| .resolve(allSystemPath.replace("/", File.separator)) | ||||||||||
| .toAbsolutePath() | ||||||||||
| .normalize() | ||||||||||
| .toFile(); | ||||||||||
|
|
@@ -206,7 +206,7 @@ private static List<List<File>> findJavaTestFilesInDirectory(File dir) { | |||||||||
| } | ||||||||||
| Arrays.sort(dirContents); | ||||||||||
| for (String fileName : dirContents) { | ||||||||||
| File file = new File(dir, fileName); | ||||||||||
| File file = dir.toPath().resolve(fileName).toFile(); | ||||||||||
| if (file.isDirectory()) { | ||||||||||
| fileGroupedByDirectory.addAll(findJavaTestFilesInDirectory(file)); | ||||||||||
| } else if (isJavaTestFile(file)) { | ||||||||||
|
|
@@ -228,7 +228,7 @@ private static List<List<File>> findJavaTestFilesInDirectory(File dir) { | |||||||||
| */ | ||||||||||
| public static List<Object[]> findFilesInParent(File parent, String... fileNames) { | ||||||||||
| return CollectionsPlume.mapList( | ||||||||||
| (String fileName) -> new Object[] {new File(parent, fileName)}, fileNames); | ||||||||||
| (String fileName) -> new Object[] {parent.toPath().resolve(fileName)}, fileNames); | ||||||||||
|
||||||||||
| (String fileName) -> new Object[] {parent.toPath().resolve(fileName)}, fileNames); | |
| (String fileName) -> | |
| new Object[] {parent.toPath().resolve(fileName).toFile()}, | |
| fileNames); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path.of(...)is not available on Java 8. To preserve Java 8 compatibility, usePaths.get(input).toFile()here.