Welcome! Please see the About page for a little more info on how this works.

0 votes
in Syntax and reader by

`
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

`

If the var symbol doesn't contains namespace ,it will throw the NPE exception in above code.Instead,i think it should use Compiler.currentNS() when doesn't find the var's namespace.

The patch is attached, after patched:

`
Clojure 1.7.0-master-SNAPSHOT
user=> #=(var a)

'user/a

`

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1507 (reported by killme2008)
...