Created
August 22, 2017 19:47
-
-
Save jgpc42/8937ea22363f8388311bf8116890ca1f to your computer and use it in GitHub Desktop.
Clojure AOT Bug wrt imports
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import [java.io InputStream]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLOJURE=~/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar | |
java -cp "$CLOJURE":. clojure.main -m foo1 | |
# => java.io.InputStream | |
rm -rf classes/ && mkdir classes | |
java -cp "$CLOJURE":classes:. clojure.main -e "(compile 'foo1)" | |
# => foo1 | |
java -cp "$CLOJURE":classes foo1 | |
# Exception in thread "main" java.lang.ExceptionInInitializerError | |
# at java.lang.Class.forName0(Native Method) | |
# at java.lang.Class.forName(Class.java:348) | |
# at clojure.lang.RT.classForName(RT.java:2168) | |
# at clojure.lang.RT.classForName(RT.java:2177) | |
# at clojure.lang.RT.loadClassForName(RT.java:2196) | |
# at clojure.lang.RT.load(RT.java:443) | |
# at clojure.lang.RT.load(RT.java:419) | |
# at clojure.core$load$fn__5677.invoke(core.clj:5893) | |
# at clojure.core$load.invokeStatic(core.clj:5892) | |
# at clojure.core$load.doInvoke(core.clj:5876) | |
# at clojure.lang.RestFn.invoke(RestFn.java:408) | |
# at foo1$loading__5569__auto____3.invoke(foo1.clj:1) | |
# at foo1__init.load(Unknown Source) | |
# at foo1__init.<clinit>(Unknown Source) | |
# at java.lang.Class.forName0(Native Method) | |
# at java.lang.Class.forName(Class.java:348) | |
# at clojure.lang.RT.classForName(RT.java:2168) | |
# at clojure.lang.RT.classForName(RT.java:2177) | |
# at clojure.lang.RT.loadClassForName(RT.java:2196) | |
# at clojure.lang.RT.load(RT.java:443) | |
# at clojure.lang.RT.load(RT.java:419) | |
# at clojure.core$load$fn__5677.invoke(core.clj:5893) | |
# at clojure.core$load.invokeStatic(core.clj:5892) | |
# at clojure.core$load.doInvoke(core.clj:5876) | |
# at clojure.lang.RestFn.invoke(RestFn.java:408) | |
# at clojure.lang.Var.invoke(Var.java:379) | |
# at clojure.lang.Util.loadWithClass(Util.java:250) | |
# at foo1.<clinit>(Unknown Source) | |
# Caused by: java.lang.NullPointerException | |
# at bar__init.load(Unknown Source) | |
# at bar__init.<clinit>(Unknown Source) | |
# ... 28 more | |
# The same error occurs on 1.9 alpha 17 as well | |
java -cp "$CLOJURE":. clojure.main -m foo2 | |
# => java.io.InputStream | |
rm -rf classes/ && mkdir classes | |
java -cp "$CLOJURE":classes:. clojure.main -e "(compile 'foo2)" | |
# => foo2 | |
java -cp "$CLOJURE":classes foo2 | |
# => java.io.InputStream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo1 | |
(:load "bar") | |
(:gen-class)) | |
(defn -main [] | |
(println InputStream)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo2 | |
(:import [java.io InputStream]) | |
(:gen-class)) | |
(defn -main [] | |
(println InputStream)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment