Why must these Java class names be fully qualified in Clojure?
I am defining a definterface
to be used with a JAX-RS REST server (RESTEasy):
(ns com.example.server.resources.buildtime
(:import [javax.ws.rs.core Cookie UriInfo]))
(definterface BuildTime
(getBuildTime [^UriInfo info
^Cookie security-cookie]))
When I AOT compile this class, I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: jav开发者_C百科a/lang/UriInfo, compiling:(com/example/server/resources/buildtime.clj:13)
If I change the annotations to the following, the error goes away:
(definterface BuildTime
(getBuildTime [^javax.ws.rs.core.UriInfo info
^javax.ws.rs.core.Cookie security-cookie]))
Why must the annotations have fully-qualified class names when the classes have been imported using import:
?
gen-class
and gen-interface
both require the class to be fully qualified as stated in the docs http://clojuredocs.org/clojure_core/clojure.core/gen-interface and http://clojuredocs.org/clojure_core/clojure.core/gen-interface. I am not aware why this is so.
精彩评论