< prev index next >
src/java.base/share/classes/jdk/internal/loader/URLClassPath.java
Print this page
8198482: The URLClassPath field "urls" should be renamed to "unopenedUrls"
Reviewed-by: alanb, mchung
@@ -102,11 +102,11 @@
/* The original search path of URLs. */
private final List<URL> path;
/* The stack of unopened URLs */
- private final Stack<URL> urls = new Stack<>();
+ private final Stack<URL> unopenedUrls = new Stack<>();
/* The resulting search path of Loaders */
private final ArrayList<Loader> loaders = new ArrayList<>();
/* Map of each URL opened to its corresponding Loader */
@@ -190,11 +190,11 @@
if (url != null) path.add(url);
}
// push the URLs
for (int i = path.size() - 1; i >= 0; --i) {
- urls.push(path.get(i));
+ unopenedUrls.push(path.get(i));
}
}
this.path = path;
this.jarHandler = null;
@@ -225,15 +225,15 @@
* URLs, then invoking this method has no effect.
*/
public synchronized void addURL(URL url) {
if (closed)
return;
- synchronized (urls) {
+ synchronized (unopenedUrls) {
if (url == null || path.contains(url))
return;
- urls.add(0, url);
+ unopenedUrls.add(0, url);
path.add(url);
}
}
/**
@@ -260,12 +260,12 @@
/**
* Returns the original search path of URLs.
*/
public URL[] getURLs() {
- synchronized (urls) {
- return path.toArray(new URL[path.size()]);
+ synchronized (unopenedUrls) {
+ return path.toArray(new URL[0]);
}
}
/**
* Finds the resource with the specified name on the URL search path
@@ -416,15 +416,15 @@
// Expand URL search path until the request can be satisfied
// or the URL stack is empty.
while (loaders.size() < index + 1) {
// Pop the next URL from the URL stack
URL url;
- synchronized (urls) {
- if (urls.empty()) {
+ synchronized (unopenedUrls) {
+ if (unopenedUrls.empty()) {
return null;
} else {
- url = urls.pop();
+ url = unopenedUrls.pop();
}
}
// 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.)
@@ -502,14 +502,14 @@
}
/*
* Pushes the specified URLs onto the list of unopened URLs.
*/
- private void push(URL[] us) {
- synchronized (urls) {
- for (int i = us.length - 1; i >= 0; --i) {
- urls.push(us[i]);
+ private void push(URL[] urls) {
+ synchronized (unopenedUrls) {
+ for (int i = urls.length - 1; i >= 0; --i) {
+ unopenedUrls.push(urls[i]);
}
}
}
/*
< prev index next >