Hi,
I don't think it is the right way to use interfaces in clojure. Take a look
at this
<https://medium.com/@ujjawaldixit099/implementing-java-interfaces-in-clojure-3e5f0b80ba14>
and this
<https://stackoverflow.com/questions/8614734/how-do-i-implement-a-java-interface-in-clojure/8615002>
.
You could create a java project with the interfaces you need and import
that instead.
I think the issue is that this setup requires AOT and it might be missing
from your configuration.
To fix it try adding this to project.clj file:
:profiles {:dev {:aot [ie4clj.api]}}
It can be tricky If you want to do lein uberjar and generate a jar file.
Alternatively, you can use compile-files
<https://clojuredocs.org/clojure.core/*compile-files*> (then you don't need
import statement).
(note that in your gist you had some errors when defining AndList, I've
fixed it)
(also take a look at the clojure style guide
<https://github.com/bbatsov/clojure-style-guide>, as AndList is not really
the way to name things in clojure )) )
(ns ie4clj.api)
(definterface Inferrable
(^boolean eval [])
(^boolean evalMembers [members]))
(ns ie4clj.AndList)
(when *compile-files*
(require 'ie4clj.api))
(def AndList
(reify
ie4clj.api.Inferrable
(eval [_] true)
(evalMembers [_ m] true)))
Hope this helps,
On Sat, 17 Jul 2021 at 21:06, Jack Park <[email protected]> wrote:
> I created a gist
> https://gist.github.com/KnowledgeGarden/39742ae9ae641f0d8facb31b288ece4c
>
> which explains a ClassNotFoundException when I am importing and reifying a
> particular interface in another clj file.
>
> It's really baffling because, in the load order, core calls a test in a
> test file - getting that to compile landed on the solution of an (:import
> ...) statement; once that worked, then the code in that test calls another
> file AndList.clj which happens to have several places where it reifies the
> same interface. Except, with the same import statement, on that file, I get
> the error. Difficult to even find a decent StackOverflow because one such
> StackOverflow appears to be very similar, and the suggested fix is what I
> have now.
>
> Thanks in advance for ideas.
> Jack
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/ffb09a94-5aa4-4600-8c9a-e0d00901df72n%40googlegroups.com
> <https://groups.google.com/d/msgid/clojure/ffb09a94-5aa4-4600-8c9a-e0d00901df72n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/CADBYUPvwWc0UqGZ-WdgtvAmkzH0RZ34_0EbbLs3QshFC2%2B3BGw%40mail.gmail.com.