When compile-path is not set to a String but to a java.io.File (that's what boot-clj does at the moment). You get a Cast exception in the compiler when trying to use it from the boot repl. Common wisdom seems to be to not compile from the repl, people say don't use gen-class. I find this unfortunate for when you do want to use gen-class and iterate quickly.
I haven't tested all older versions for this issue, but git blame shows that the code that should help here wasn't changed for 10 years:
https://github.com/clojure/clojure/blame/master/src/clj/clojure/core.clj#L6073
https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L7643
My workaround now is:
I suggest to put the type check in the 'clojure.core/compile function.
Mac OS, boot-clj
Reference to common wisdom https://clojurians-log.clojureverse.org/clojure/2017-06-05/1496700773.347309
The following works in boot-clj (because of classpath issues not in Leiningen and clj cli): https://gist.github.com/jeroenvandijk/8187413d24433545eeb9579538a903f7#file-repl_compile-clj-L39-L52
Can you provide a reproducible example?
Seems like ClassCastException is pretty accurate for having a class of the wrong type.
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).