mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
Initialize 'loaderPath' ArrayList eagerly
This commit is contained in:
parent
4a19b342be
commit
f86cd2d3a7
@ -110,7 +110,7 @@ public class URLClassPath {
|
||||
/* A list of loader-discovered URLs, if any.
|
||||
* Access is guared by a monitor on 'path'
|
||||
*/
|
||||
private ArrayList<URL> loaderPath;
|
||||
private final ArrayList<URL> loaderPath = new ArrayList<>();
|
||||
|
||||
/* The resulting search path of Loaders */
|
||||
private final ArrayList<Loader> loaders = new ArrayList<>();
|
||||
@ -377,7 +377,7 @@ public class URLClassPath {
|
||||
*/
|
||||
private URL nextURL() {
|
||||
// Check any loader-discovered class path first
|
||||
if (loaderPath != null && !loaderPath.isEmpty()) {
|
||||
if (!loaderPath.isEmpty()) {
|
||||
return loaderPath.removeLast();
|
||||
}
|
||||
// Check the original search path
|
||||
@ -487,10 +487,6 @@ public class URLClassPath {
|
||||
*/
|
||||
private void push(URL[] urls) {
|
||||
synchronized (path) {
|
||||
// Lazily create list
|
||||
if (loaderPath == null) {
|
||||
loaderPath = new ArrayList<>();
|
||||
}
|
||||
// URLs will be consumed tail-first
|
||||
for (int i = urls.length - 1; i >= 0; --i) {
|
||||
loaderPath.addLast(urls[i]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user