what happens is the evaluator pushes a dynamicclassloader, evaluates some code, then -m foo.bar causes foo.bar/-main to be called, which tries to read in a literal for the just defined record, but it fails because when foo.bar/-main is called clojure.lang.Compiler/LOADER is unbound so RT uses the sun.misc classloader to try and find the class, which it knows nothing about
Approaches: If the patch 0001-CLJ-979-make-clojure-resolve-to-the-correct-Class-in-v2.patch for were to be committed, this issue would be automatically fixed aswell and the patch attached to this ticket would be unnecessary.
Alternatively, the attached patch (0001-CLJ-1457-ensure-Compiler.LOADER-is-bound-while-readi.patch) simply forces a DynamicClassLoader to be bound to clojure.lang.Compiler/LOADER during reading.
In the other issue, Lars Bohl has a reproducible example of a very simple or even simplest possible case.
The patch 0001-CLJ-979-make-clojure-resolve-to-the-correct-Class-in-v2.patch from contains a workaround that fixes this bug.
For completeness here's an alternative patch to the one proposed for that fixes this issue by ensuring Compiler/LOADER is bound to a DynamicClassLoader while reading
Since is headed into 1.7.0-alpha5, I'm duping this to that.