Skip to content

Commit

Permalink
added speculative load when no .clj or .class resource found, for Dal…
Browse files Browse the repository at this point in the history
…vik VM
  • Loading branch information
richhickey committed Dec 29, 2008
1 parent e6fed02 commit db598ed
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/jvm/clojure/lang/RT.java
Expand Up @@ -381,6 +381,7 @@ static public void load(String scriptbase, boolean failIfNotFound) throws Except
String cljfile = scriptbase + ".clj";
URL classURL = baseLoader().getResource(classfile);
URL cljURL = baseLoader().getResource(cljfile);
boolean failed = false;

if(classURL != null &&
(cljURL == null
Expand All @@ -405,7 +406,22 @@ else if(cljURL != null)
else
loadResourceScript(RT.class, cljfile);
}
else if(failIfNotFound)
else
{
try
{
Var.pushThreadBindings(
RT.map(CURRENT_NS, CURRENT_NS.get(),
WARN_ON_REFLECTION, WARN_ON_REFLECTION.get()));
failed = loadClassForName(scriptbase.replace('/','.') + LOADER_SUFFIX) == null;
}
finally
{
Var.popThreadBindings();
}
}

if(failed && failIfNotFound)
throw new FileNotFoundException(String.format("Could not locate %s or %s on classpath: ", classfile, cljfile));
}

Expand Down

0 comments on commit db598ed

Please sign in to comment.