NullPointerException when a >defn calls another >defn with invalid arguments
Opened this issue · 1 comments
whmountains commented
I accidentally hit enter before I was ready, so apologies to anyone who may have gotten a confusing email notification.
I am getting a NullPointerException related to clojure.string/split-lines when a >defn
is being generatively tested, and calls another function with arguments that don't match the spec. I find myself constantly hitting this. Instead of a concise error message I get pages and pages of nested stack traces.
Here is my minimal reproduction.
(>defn inner
[input]
[int? => string?]
(str input))
(>defn outer
[input]
[string? => string?]
(inner input))
(g/check)
It appears the error is coming from line 180 in reporting.cljc. Here is a snippet of the stack trace:
{:file "Matcher.java",
:line 1770,
:type :error,
:expected
(clojure.core/and
(clojure.core/every?
(fn*
[p1__2441__2443__auto__]
(clojure.core/->
p1__2441__2443__auto__
:clojure.spec.test.check/ret
:pass?))
spec-checks__2442__auto__)
true
true),
:actual #error {
:cause nil
:via
[{:type java.lang.NullPointerException
:message nil
:at [java.util.regex.Matcher getTextLength "Matcher.java" 1770]}]
:trace
[[java.util.regex.Matcher getTextLength "Matcher.java" 1770]
[java.util.regex.Matcher reset "Matcher.java" 416]
[java.util.regex.Matcher <init> "Matcher.java" 253]
[java.util.regex.Pattern matcher "Pattern.java" 1135]
[java.util.regex.Pattern split "Pattern.java" 1263]
[java.util.regex.Pattern split "Pattern.java" 1336]
[clojure.string$split invokeStatic "string.clj" 224]
[clojure.string$split_lines invokeStatic "string.clj" 228]
[clojure.string$split_lines invoke "string.clj" 228]
[ghostwheel.reporting$report_spec_check invokeStatic "reporting.c
ljc" 180]
[ghostwheel.reporting$report_spec_check invoke "reporting.cljc" 163]
[ghostwheel.reporting$eval2004$fn__2005 invoke "reporting.cljc" 208]
[clojure.lang.MultiFn invoke "MultiFn.java" 229]
[clojure.test$do_report invokeStatic "test.clj" 357]
[clojure.test$do_report invoke "test.clj" 351]
[ghostwheel_repr.core$fn__11380 invokeStatic "core.clj" 12]
;; stack trace continues into clojure internals...
]
;; other properties elided
}