Skip to content

Commit

Permalink
Use Paths.get rather than Path.of in Html5libTest
Browse files Browse the repository at this point in the history
This change replaces Path.of() calls in Html5libTest with Paths.get().

Per https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#of(java.net.URI)
Path.of() was introduced in Java 11. So Java 8 has no Path.of(); see
also https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html

We need to continue to support Java 8 for the time being. It seems
Paths.get() will eventually end up being formally deprecated; by the
time it finally is, we may also be able to quit supporting Java 8 — and
so we can just switch to Path.of() then.
  • Loading branch information
sideshowbarker committed Sep 4, 2020
1 parent 8a48cb0 commit 390d9a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test-src/nu/validator/htmlparser/test/Html5libTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.function.Consumer;
Expand All @@ -38,7 +39,7 @@ public class Html5libTest {
private final Path testDir;

public Html5libTest() throws URISyntaxException {
this.testDir = Path.of(
this.testDir = Paths.get(
Html5libTest.class.getResource("/html5lib-tests").toURI());
}

Expand Down Expand Up @@ -111,7 +112,8 @@ private TestVisitor(boolean skipScripted, String requiredTestExtension,
@Override
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) throws IOException {
if (skipScripted && dir.getFileName().equals(Path.of("scripted"))) {
if (skipScripted
&& dir.getFileName().equals(Paths.get("scripted"))) {
return FileVisitResult.SKIP_SUBTREE;
}

Expand Down

0 comments on commit 390d9a9

Please sign in to comment.