`
Clojure 1.7.0-master-SNAPSHOT
user=> #=(var a)
NullPointerException clojure.lang.Symbol.hashCode (Symbol.java:84)
user=> (.printStackTrace *e)
clojure.lang.LispReader$ReaderException: clojure.lang.LispReader$ReaderException: java.lang.NullPointerException
at clojure.lang.LispReader.read(LispReader.java:218)
at clojure.core$read.invoke(core.clj:3580)
at clojure.core$read.invoke(core.clj:3578)
at clojure.core$read.invoke(core.clj:3576)
at clojure.core$read.invoke(core.clj:3574)
at clojure.main$repl_read.invoke(main.clj:139)
at clojure.main$repl$read_eval_print__6807$fn__6808.invoke(main.clj:237)
at clojure.main$repl$read_eval_print__6807.invoke(main.clj:237)
at clojure.main$repl$fn__6816.invoke(main.clj:257)
at clojure.main$repl.doInvoke(main.clj:257)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.main$repl_opt.invoke(main.clj:323)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.Var.invoke(Var.java:375)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: clojure.lang.LispReader$ReaderException: java.lang.NullPointerException
at clojure.lang.LispReader.read(LispReader.java:218)
at clojure.lang.LispReader$CtorReader.invoke(LispReader.java:1164)
at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:609)
at clojure.lang.LispReader.read(LispReader.java:183)
... 17 more
Caused by: java.lang.NullPointerException
at clojure.lang.Symbol.hashCode(Symbol.java:84)
at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:332)
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:987)
at clojure.lang.Namespace.findOrCreate(Namespace.java:173)
at clojure.lang.RT.var(RT.java:341)
at clojure.lang.LispReader$EvalReader.invoke(LispReader.java:1042)
at clojure.lang.LispReader$DispatchReader.invoke(LispReader.java:616)
at clojure.lang.LispReader.read(LispReader.java:183)
... 20 more
`
如果var符号不包含命名空间,则在上述代码中将抛出NPE异常。相反,我认为应该使用Compiler.currentNS()来找不到var的命名空间。
补丁已附上,修复后
`
Clojure 1.7.0-master-SNAPSHOT
user=> #=(var a)
'user/a
`