Use Path.of() instead of Paths.get()
Path.of() makes Paths.get() obsolete in Java 11
Change-Id: I5fd7899d1baa0531265f9ae057bb0fbbba27f9dc
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
index 9ff15fb..21e2a8d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
@@ -28,7 +28,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Objects;
import java.util.Optional;
import java.util.jar.Attributes;
@@ -56,14 +55,14 @@
public CorePluginsRepository(Path siteGerritWar, String gerritWar, CorePluginsDescriptions pd) {
this.pluginsDescriptions = pd;
final String normalizedWar = gerritWar.replace(WINDOWS_FILE_SEPARATOR, UNIX_FILE_SEPARATOR);
- this.gerritWarUri = Paths.get(normalizedWar).toUri().toString();
+ this.gerritWarUri = Path.of(normalizedWar).toUri().toString();
this.siteGerritWar = siteGerritWar;
}
@Nullable
private PluginInfo extractPluginInfoFromJarEntry(JarEntry entry) {
try {
- Path entryName = Paths.get(entry.getName());
+ Path entryName = Path.of(entry.getName());
URI pluginUrl = new URI("jar:" + gerritWarUri + "!/" + entry.getName());
try (JarInputStream pluginJar = new JarInputStream(pluginUrl.toURL().openStream())) {
return getManifestEntry(pluginJar)
diff --git a/src/test/java/com/googlesource/gerrit/plugins/manager/repository/PluginsRepositoryTest.java b/src/test/java/com/googlesource/gerrit/plugins/manager/repository/PluginsRepositoryTest.java
index bd74235..d626562 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/manager/repository/PluginsRepositoryTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/manager/repository/PluginsRepositoryTest.java
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Collection;
import org.junit.Test;
@@ -72,8 +71,7 @@
private SitePaths prepareSiteDirWithReleaseWar() throws IOException {
SitePaths site = new SitePaths(random());
- Path pathToReleaseWar =
- Paths.get(getenv("TEST_SRCDIR"), getenv("TEST_WORKSPACE"), "release.war");
+ Path pathToReleaseWar = Path.of(getenv("TEST_SRCDIR"), getenv("TEST_WORKSPACE"), "release.war");
assume().that(pathToReleaseWar.toFile().exists()).isTrue();
Files.createDirectories(site.bin_dir);
Files.createSymbolicLink(site.gerrit_war, pathToReleaseWar);