diff --git a/src/test/org/apache/commons/logging/PathableClassLoader.java b/src/test/org/apache/commons/logging/PathableClassLoader.java index 3c80cb5..f2c3a3b 100644 --- a/src/test/org/apache/commons/logging/PathableClassLoader.java +++ b/src/test/org/apache/commons/logging/PathableClassLoader.java @@ -72,9 +72,27 @@ public class PathableClassLoader extends URLClassLoader { * See setParentFirst. */ private boolean parentFirst = true; - + /** * Constructor. + *
+ * Often, null is passed as the parent, ie the parent of the new + * instance is the bootloader. This ensures that the classpath is + * totally clean; nothing but the standard java library will be + * present. + *
+ * When using a null parent classloader with a junit testcase, it *is* + * necessary for the junit library to also be visible. In this case, it + * is recommended that the following code be used: + *
+ * pathableLoader.useExplicitLoader( + * "junit.", + * junit.framework.Test.class.getClassLoader()); + *+ * Note that this works regardless of whether junit is on the system + * classpath, or whether it has been loaded by some test framework that + * creates its own classloader to run unit tests in (eg maven2's + * Surefire plugin). */ public PathableClassLoader(ClassLoader parent) { super(NO_URLS, parent); @@ -125,6 +143,28 @@ public class PathableClassLoader extends URLClassLoader { /** * Specify a classloader to use for specific java packages. + *
+ * The specified classloader is normally a loader that is NOT + * an ancestor of this classloader. In particular, this loader + * may have the bootloader as its parent, but be configured to + * see specific other classes (eg the junit library loaded + * via the system classloader). + *
+ * The differences between using this method, and using + * addLogicalLib are: + *