Hello,
Is there a reason for the test for (classURL==null) being one of the
condition to try loading the class, in the code of RT.load() (see below the
line with the comment at its end) ?
I think the code will work because there is a catch clause in
loadClassForName, but I can't see any reason to try to call
loadClassForName() when we know we haven't found the class file as a
resource ?
Thanks in advance,
--
Laurent
static public void load(String scriptbase, boolean failIfNotFound) throws
Exception{
String classfile = scriptbase + LOADER_SUFFIX + ".class";
String cljfile = scriptbase + ".clj";
URL classURL = baseLoader().getResource(classfile);
URL cljURL = baseLoader().getResource(cljfile);
boolean loaded = false;
if((classURL != null &&
(cljURL == null
|| lastModified(classURL, classfile) > lastModified(cljURL,
cljfile)))
|| classURL == null) // <<<<<<<<<<<<<<<<<<<<<<<<<<< Why enter the
if clause if classURL is null ?
{
try
{
Var.pushThreadBindings(
RT.map(CURRENT_NS, CURRENT_NS.get(),
WARN_ON_REFLECTION, WARN_ON_REFLECTION.get()));
loaded = (loadClassForName(scriptbase.replace('/','.') +
LOADER_SUFFIX) != null);
}
finally
{
Var.popThreadBindings();
}
}
if(!loaded && cljURL != null)
{
if (booleanCast(Compiler.COMPILE_FILES.get()))
compile(cljfile);
else
loadResourceScript(RT.class, cljfile);
}
else if(!loaded && failIfNotFound)
throw new FileNotFoundException(String.format("Could not locate %s
or %s on classpath: ", classfile, cljfile));
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---