Skip to content

Instantly share code, notes, and snippets.

@ninjudd
Created May 15, 2010 06:10
Show Gist options
  • Save ninjudd/402056 to your computer and use it in GitHub Desktop.
Save ninjudd/402056 to your computer and use it in GitHub Desktop.
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 44ad147..e27bd85 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -181,13 +181,13 @@ final static public Var AGENT = Var.intern(CLOJURE_NS, Symbol.create("*agent*"),
final static public Var READEVAL = Var.intern(CLOJURE_NS, Symbol.create("*read-eval*"), T);
final static public Var ASSERT = Var.intern(CLOJURE_NS, Symbol.create("*assert*"), T);
final static public Var MATH_CONTEXT = Var.intern(CLOJURE_NS, Symbol.create("*math-context*"), null);
static Keyword LINE_KEY = Keyword.intern(null, "line");
static Keyword FILE_KEY = Keyword.intern(null, "file");
final static public Var USE_CONTEXT_CLASSLOADER =
- Var.intern(CLOJURE_NS, Symbol.create("*use-context-classloader*"), T);
+ Var.intern(CLOJURE_NS, Symbol.create("*use-context-classloader*"), null);
//final static public Var CURRENT_MODULE = Var.intern(Symbol.create("clojure.core", "current-module"),
// Module.findOrCreateModule("clojure/user"));
final static Symbol LOAD_FILE = Symbol.create("load-file");
final static Symbol IN_NAMESPACE = Symbol.create("in-ns");
final static Symbol NAMESPACE = Symbol.create("ns");
@@ -1528,30 +1528,21 @@ static public Object[] setValues(Object... vals){
}
static public ClassLoader makeClassLoader(){
return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction(){
public Object run(){
+ return new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
- try{
- Var.pushThreadBindings(RT.map(USE_CONTEXT_CLASSLOADER, RT.T));
-// getRootClassLoader();
- return new DynamicClassLoader(baseLoader());
- }
- finally{
- Var.popThreadBindings();
- }
}
});
}
static public ClassLoader baseLoader(){
- if(Compiler.LOADER.isBound())
+ if(Compiler.LOADER.isBound() && !booleanCast(USE_CONTEXT_CLASSLOADER.deref()))
return (ClassLoader) Compiler.LOADER.deref();
- else if(booleanCast(USE_CONTEXT_CLASSLOADER.deref()))
return Thread.currentThread().getContextClassLoader();
- return Compiler.class.getClassLoader();
}
@ninjudd
Copy link
Author

ninjudd commented May 15, 2010

use-context-classloader should default to false, as it did originally, and it should always be obeyed by RT.baseLoader. the current implementation only uses the context classloader when Compile.LOADER isn't bound, which makes it impossible to use a custom classloader for import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment