From 009f5e1fa177eea326aefec0f995f589a01169d2 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Sat, 30 Sep 2023 01:06:16 +0000 Subject: [PATCH] 8317141: Remove unused validIndex method from URLClassPath$JarLoader Reviewed-by: alanb, lancea, dfuchs --- .../jdk/internal/loader/URLClassPath.java | 44 ++----------------- 1 file changed, 3 insertions(+), 41 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index bf123511f58..dbd76e07d4f 100644 --- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -433,9 +433,7 @@ public class URLClassPath { if (url == null) return null; } - // Skip this URL if it already has a Loader. (Loader - // may be null in the case where URL has not been opened - // but is referenced by a JAR index.) + // Skip this URL if it already has a Loader. String urlNoFragString = URLUtil.urlNoFragString(url); if (lmap.containsKey(urlNoFragString)) { continue; @@ -489,12 +487,12 @@ public class URLClassPath { // extract the nested URL @SuppressWarnings("deprecation") URL nestedUrl = new URL(file.substring(0, file.length() - 2)); - return new JarLoader(nestedUrl, jarHandler, lmap, acc); + return new JarLoader(nestedUrl, jarHandler, acc); } else { return new Loader(url); } } else { - return new JarLoader(url, jarHandler, lmap, acc); + return new JarLoader(url, jarHandler, acc); } } }, acc); @@ -708,8 +706,6 @@ public class URLClassPath { private static class JarLoader extends Loader { private JarFile jar; private final URL csu; - private URLStreamHandler handler; - private final HashMap lmap; @SuppressWarnings("removal") private final AccessControlContext acc; private boolean closed = false; @@ -721,14 +717,11 @@ public class URLClassPath { * a JAR file. */ private JarLoader(URL url, URLStreamHandler jarHandler, - HashMap loaderMap, @SuppressWarnings("removal") AccessControlContext acc) throws IOException { super(newURL("jar", "", -1, url + "!/", jarHandler)); csu = url; - handler = jarHandler; - lmap = loaderMap; this.acc = acc; ensureOpen(); @@ -752,10 +745,6 @@ public class URLClassPath { } } - JarFile getJarFile () { - return jar; - } - private boolean isOptimizable(URL url) { return "file".equals(url.getProtocol()); } @@ -871,33 +860,6 @@ public class URLClassPath { }; } - - /* - * Returns true iff at least one resource in the jar file has the same - * package name as that of the specified resource name. - */ - boolean validIndex(final String name) { - String packageName = name; - int pos; - if ((pos = name.lastIndexOf('/')) != -1) { - packageName = name.substring(0, pos); - } - - String entryName; - ZipEntry entry; - Enumeration enum_ = jar.entries(); - while (enum_.hasMoreElements()) { - entry = enum_.nextElement(); - entryName = entry.getName(); - if ((pos = entryName.lastIndexOf('/')) != -1) - entryName = entryName.substring(0, pos); - if (entryName.equals(packageName)) { - return true; - } - } - return false; - } - /* * Returns the URL for a resource with the specified name */