The following minimal example shows the error:
(defn f ^double [])
(f)
=> NullPointerException
When decompiling the function f
I found the following return expression:
return null.doubleValue();
This happened in a Java interop scenario where the called Java method had no return value but was in the return position of the primitive Clojure function.
The compiler should check for null
on compilation.
Another example - calling a method with void return as the last expression fails in a similar way:
(defn f ^double [^SomeClassToAvoidRuntimeReflection obj, x, y]
(.someMethod obj, x, y))
(f obj, x, y)
=> NullPointerException