We're updating the issue view to help you get more done. 

NPE when AOTing overrided clojure.core functions

Description

When performing AOT compilation on a namespace that overrides a clojure.core function without excluding the original clojure.core function from the ns, you get a NullPointerException.

To reproduce aot compile a namespace like "(ns x) (defn get [])"

For example:

1 2 3 4 5 6 7 8 9 10 11 12 13 $ lein new aot-get $ cd aot-get $ sed -i s/foo/get/ $ lein compile :all WARNING: get already refers to: #'clojure.core/get in namespace: aot-get.core, being replaced by: #'aot-get.core/get Exception in thread "main" java.lang.NullPointerException at clojure.lang.Compiler$ObjExpr.emitVar(Compiler.java:4858) at clojure.lang.Compiler$DefExpr.emit(Compiler.java:428) at clojure.lang.Compiler.compile1(Compiler.java:7152) at clojure.lang.Compiler.compile(Compiler.java:7219) at clojure.lang.RT.compile(RT.java:398) at clojure.lang.RT.load(RT.java:438) at clojure.lang.RT.load(RT.java:411)

Cause: DefExpr.parse does not call registerVar for vars overridding clojure.core ones, thus when AOT compiling the var is not registered in the constant table.

Proposed: The attached patch makes DefExpr.parse call registerVar for vars overridding clojure.core ones.

Patch: 0001-fix-CLJ-1241.patch

Screened by: Alex Miller

Environment

None

Status

Assignee

Unassigned

Reporter

import

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Release 1.5
Release 1.6

Priority

Major