Open pkozikow opened 9 years ago
The following code:
(defn rand-int ([] (.nextInt rnd)) ([mx] (.nextInt rnd mx)))
causes an exception at compile time (below). The code compiles and works fine when built with maven outside of intellij. Renaming the function to rand-integer makes the problem go away.
Error:clojure: Compiling com.liveramp.online-identity.bang.graph-builder.stochastic.generate: java.lang.NullPointerException: null at clojure.lang.Compiler$ObjExpr.emitVar (Compiler.java:4944) clojure.lang.Compiler$DefExpr.emit (Compiler.java:437) clojure.lang.Compiler.compile1 (Compiler.java:7225) clojure.lang.Compiler.compile (Compiler.java:7292) clojure.lang.RT.compile (RT.java:398) clojure.lang.RT.load (RT.java:438) clojure.lang.RT.load (RT.java:411) clojure.core$load$fn__5066.invoke (core.clj:5641) clojure.core$load.doInvoke (core.clj:5640) clojure.lang.RestFn.invoke (RestFn.java:408) clojure.core$load_one.invoke (core.clj:5446) clojure.core$compile$fn5071.invoke (core.clj:5652) clojure.core$compile.invoke (core.clj:5651) user$eval8$fn9.invoke (clojurekul0.clj:7) user$eval8.invoke (clojurekul0.clj:6) clojure.lang.Compiler.eval (Compiler.java:6703) clojure.lang.Compiler.load (Compiler.java:7130) clojure.lang.Compiler.loadFile (Compiler.java:7086) clojure.main$load_script.invoke (main.clj:274) clojure.main$script_opt.invoke (main.clj:336) clojure.main$main.doInvoke (main.clj:420) clojure.lang.RestFn.invoke (RestFn.java:408) clojure.lang.Var.invoke (Var.java:379) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.Var.applyTo (Var.java:700) clojure.main.main (main.java:37) sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2) sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke (Method.java:597) com.intellij.rt.execution.CommandLineWrapper.main (CommandLineWrapper.java:130)
Interesting - if you :refer-clojure :exclude [rand-int] does that fix it?
:refer-clojure :exclude [rand-int]
Yes, that fixes it. Still, it's inconsistent with the maven behavior.
Yes, definitely, I was just curious - thanks.
The following code:
causes an exception at compile time (below). The code compiles and works fine when built with maven outside of intellij. Renaming the function to rand-integer makes the problem go away.
Error:clojure: Compiling com.liveramp.online-identity.bang.graph-builder.stochastic.generate: java.lang.NullPointerException: null at clojure.lang.Compiler$ObjExpr.emitVar (Compiler.java:4944) clojure.lang.Compiler$DefExpr.emit (Compiler.java:437) clojure.lang.Compiler.compile1 (Compiler.java:7225) clojure.lang.Compiler.compile (Compiler.java:7292) clojure.lang.RT.compile (RT.java:398) clojure.lang.RT.load (RT.java:438) clojure.lang.RT.load (RT.java:411) clojure.core$load$fn__5066.invoke (core.clj:5641) clojure.core$load.doInvoke (core.clj:5640) clojure.lang.RestFn.invoke (RestFn.java:408) clojure.core$load_one.invoke (core.clj:5446) clojure.core$compile$fn5071.invoke (core.clj:5652) clojure.core$compile.invoke (core.clj:5651) user$eval8$fn9.invoke (clojurekul0.clj:7) user$eval8.invoke (clojurekul0.clj:6) clojure.lang.Compiler.eval (Compiler.java:6703) clojure.lang.Compiler.load (Compiler.java:7130) clojure.lang.Compiler.loadFile (Compiler.java:7086) clojure.main$load_script.invoke (main.clj:274) clojure.main$script_opt.invoke (main.clj:336) clojure.main$main.doInvoke (main.clj:420) clojure.lang.RestFn.invoke (RestFn.java:408) clojure.lang.Var.invoke (Var.java:379) clojure.lang.AFn.applyToHelper (AFn.java:154) clojure.lang.Var.applyTo (Var.java:700) clojure.main.main (main.java:37) sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2) sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke (Method.java:597) com.intellij.rt.execution.CommandLineWrapper.main (CommandLineWrapper.java:130)