_Comment made by: jeroen_
I've tried to make the example as simple as possible. You are right that the ClassCastException is perfectly accurate, but you realise this only after you have figured out it's about *compile-path*. This bug report is mostly about managing expectations (of the clojure user).
clj -A:new app example.error
cd example.error
clj
;; clj has the *compile-path* set correctly to a string (although not in the classpath)
*compile-path* ;=> "classes"
(let [f (clojure.java.io/file "classes/foo.clj")]
(clojure.java.io/make-parents f)
(spit f "(ns foo) (gen-class :name my.new.Class)")
(compile 'foo)
(clojure.java.shell/sh "ls" "classes"))
; success, although you still cannot load the class
; #=> {:exit 0, :out "clojure\nfoo$fn__134.class\nfoo$fn__166.class\nfoo$fn__174.class\nfoo$loading__6549__auto____132.class\nfoo$loading__6549__auto____164.class\nfoo$loading__6549__auto____172.class\nfoo.clj\nfoo__init.class\n", :err ""}
;; From a boot project:
;; boot.user=> *compile-path*
;; #object[java.io.File 0x5266b1a "/var/folders/ck/9zqvs0zx5vsf2bc7rvv1pwc40000gn/T/boot-repl8170014881711480931"]
;; This can be reproduced in the clj repl:
(binding [*compile-path* (clojure.java.io/file "classes")]
(compile 'foo)
)
Syntax error compiling fn* at (foo.clj:1:1).
Cause: java.io.File cannot be cast to java.lang.String