From 390d9a91e8b5008516d25e648a514dafc32bb833 Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Tue, 1 Sep 2020 12:34:18 +0900 Subject: [PATCH] Use Paths.get rather than Path.of in Html5libTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- test-src/nu/validator/htmlparser/test/Html5libTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test-src/nu/validator/htmlparser/test/Html5libTest.java b/test-src/nu/validator/htmlparser/test/Html5libTest.java index 67770481..724062e2 100644 --- a/test-src/nu/validator/htmlparser/test/Html5libTest.java +++ b/test-src/nu/validator/htmlparser/test/Html5libTest.java @@ -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; @@ -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()); } @@ -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; }