Both available constructors of JavaDocBuilder will eventually call
classLibrary.addDefaultLoader();
As far as I see, there is currently no way to disable/remove these default loaders.
This is problematic when the code using QDox and the code being analyzed depend on the same class file (but possibly a different version). Imagine a project with an annotated source file S that extends a class C from a third-party JAR. Further imagine a build tool that employs QDox to scan the previously mentioned source file S. When the scan walks up to the super class C of S, QDox ends up in ClassLibrary.getClass() and iterates over the class loaders to load the class C from its binary. Now imagine the build tool itself also depends on this binary class C and the build tool's class loader was used to create the JavaDocBuilder instance used for the scan. In this scenario, QDox will load C from the dependencies of the build tool instead of the dependencies of the project whose sources are actually scanned. In other words, the class path of the QDox client pollutes the analysis.
Possible solutions could be a additional constructors for JavaDocBuilder to disable addition of the default class loaders or a new method clearClassLoaders() in ClassLibrary.
A not so beauty unit test for this.