Discussion:
ClassCastException using spec-infer
Emlyn Corrin
2016-09-07 11:12:52 UTC
Permalink
That helped - I was able to run spec-infer without errors, but then it
didn't generate any specs (and runtime-infer just put in an empty
(declare)). I think it might be because the code is aot compiled, would
that prevent this working?
OK, I temporarily moved my local maven repository and reran 'lein deps'.
Amongst everything it downloaded was tools.reader version 0.10.0 (plus the
poms for a few other versions). That must be what's causing the problem,
but I'm not sure why it's not showing up in 'lein deps :tree'. After some
more investigation, it look like it's being pulled in by timbre (via
encore) - I'll try excluding it from there and see how I get on.
Hi Ambrose,
It's a rather large tree (maybe I should have started on a simpler
project...), but the only tools.reader in there
is [org.clojure/tools.reader "1.0.0-beta3"] via core.typed. However if I
build the uberjar and look inside at clojure/tools/reader/reader_types.clj,
the IndexingPushbackReader in there does not implement Closeable. I guess
it must also be packaged in some other dependency, but I'm not sure how to
go about finding which one... any ideas?
Thanks for your help,
Emlyn
On Tuesday, 6 September 2016 21:03:02 UTC+1, Ambrose Bonnaire-Sergeant
Hi Emlyn,
IIRC, this is a recent tools.reader feature.
What's your `lein deps :tree` ?
Thanks,
Ambrose
I've been trying out the automatic type/spec annotations, they are
really cool!
The demo project worked well, but when I tried it on my own project,
ClassCastException
clojure.tools.reader.reader_types.IndexingPushbackReader cannot be cast to
java.io.Closeable clojure.core.typed.runtime-infer/ns-end-line/fn--24319
(runtime_infer.clj:2565)
https://github.com/clojure/core.typed/blob/e4f3b7f29ed3449aaf8e4e56a9dc3e39f4f7b0af/module-check/src/main/clojure/clojure/core/typed/runtime_infer.clj#L2706
which uses an IndexingPushBackReader in a with-open, but
IndexingPushBackReader doesn't implement the Closeable interface.
Is this a bug in core.typed (it shouldn't use with-open?), or
tools.reader (IndexingPushBackReader should implement Closeable?), or am I
doing something wrong (maybe I have some conflicting deps)?
Thanks,
Emlyn
Loading...