src/share/classes/com/sun/tools/javac/util/BaseFileManager.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -110,13 +110,12 @@
}
protected ClassLoader getClassLoader(URL[] urls) {
ClassLoader thisClassLoader = getClass().getClassLoader();
- // Bug: 6558476
- // Ideally, ClassLoader should be Closeable, but before JDK7 it is not.
- // On older versions, try the following, to get a closeable classloader.
+ // Allow the following to specify a closeable classloader
+ // other than URLClassLoader.
// 1: Allow client to specify the class to use via hidden option
if (classLoaderClass != null) {
try {
Class<? extends ClassLoader> loader =
@@ -126,23 +125,10 @@
return constr.newInstance(new Object[] { urls, thisClassLoader });
} catch (Throwable t) {
// ignore errors loading user-provided class loader, fall through
}
}
-
- // 2: If URLClassLoader implements Closeable, use that.
- if (Closeable.class.isAssignableFrom(URLClassLoader.class))
- return new URLClassLoader(urls, thisClassLoader);
-
- // 3: Try using private reflection-based CloseableURLClassLoader
- try {
- return new CloseableURLClassLoader(urls, thisClassLoader);
- } catch (Throwable t) {
- // ignore errors loading workaround class loader, fall through
- }
-
- // 4: If all else fails, use plain old standard URLClassLoader
return new URLClassLoader(urls, thisClassLoader);
}
// <editor-fold defaultstate="collapsed" desc="Option handling">
public boolean handleOption(String current, Iterator<String> remaining) {