summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-12-29 17:00:39 +0000
committerRich Hickey <richhickey@gmail.com>2008-12-29 17:00:39 +0000
commitdb598ed1a8d2105f552e1dcdaf2b37b781f015e0 (patch)
tree772245b61d69e2a2feb4ff26ff8e1b761754371e
parente6fed020c75318cd3afa110d3213efaed2bf6988 (diff)
added speculative load when no .clj or .class resource found, for Dalvik VM
-rw-r--r--src/jvm/clojure/lang/RT.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 4cb775ee..fe7e95e7 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -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
@@ -405,7 +406,22 @@ static public void load(String scriptbase, boolean failIfNotFound) throws Except
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));
}