-
Notifications
You must be signed in to change notification settings - Fork 3
Possible issue with AOT compilation. #8
Description
While writing an application, I ran into an issue where I'd get an exception thrown:
Exception in thread "main" java.lang.ClassCastException: clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848 cannot be cast to clojure.pprint.PrettyFlush
I've been able to reproduce this with a much smaller example. I created two versions of the project, a Gradle version and a Leiningen version. The code is the same in both, the only difference here are the build tools. You can find them here:
https://github.com/jszakmeister/aot-pprint-gradle
https://github.com/jszakmeister/aot-pprint-lein
I'm using the shadow plugin to create an uberjar for gradle. To see the problem, checkout aot-pprint-gradle, run gradle shadowJar, and then run java -jar build/libs/aot-pprint-gradle-0.1.0-SNAPSHOT-all.jar. For the Leiningen version, check it out, run lein uberjar, and then run java -jar target/uberjar/aot-pprint-0.1.0-SNAPSHOT-standalone.jar. You'll see that the Gradle version fails, but the Leiningen version succeeds.
It's not clear what's going on here, and why the difference. I don't know enough about the under-the-hood bits between the implementations to point you in the right direction or I'd supply a patch (sorry!). But hopefully, it helps you to identify the problem.