summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChas Emerick <cemerick@snowtide.com>2010-11-19 22:18:21 -0500
committerStuart Halloway <stu@thinkrelevance.com>2010-11-29 21:01:27 -0500
commitc6e7e5765e4bd6624e87115819d384f4a755d700 (patch)
tree6005e9ed57cf0bff095f870b492b6b8c358dffdb
parent56bde33ee946af4022be5f592d38adcddf919e8e (diff)
properly munge namespaces -> java package names for protocols and deftype and friends; fixes CLJ-432
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
-rw-r--r--src/clj/clojure/core_deftype.clj10
-rw-r--r--test/clojure/test_clojure/protocols.clj4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/clj/clojure/core_deftype.clj b/src/clj/clojure/core_deftype.clj
index 344f9811..97ccd05b 100644
--- a/src/clj/clojure/core_deftype.clj
+++ b/src/clj/clojure/core_deftype.clj
@@ -136,7 +136,7 @@
{:added "1.2"}
[tagname name fields interfaces methods]
(let [tag (keyword (str *ns*) (str tagname))
- classname (with-meta (symbol (str *ns* "." name)) (meta name))
+ classname (with-meta (symbol (str (namespace-munge *ns*) "." name)) (meta name))
interfaces (vec interfaces)
interface-set (set (map resolve interfaces))
methodname-set (set (map first methods))
@@ -292,7 +292,7 @@
[name [& fields] & opts+specs]
(let [gname name
[interfaces methods opts] (parse-opts+specs opts+specs)
- classname (symbol (str *ns* "." gname))
+ classname (symbol (str (namespace-munge *ns*) "." gname))
tag (keyword (str *ns*) (str name))
hinted-fields fields
fields (vec (map #(with-meta % nil) fields))]
@@ -316,7 +316,7 @@
(defn- emit-deftype*
"Do not use this directly - use deftype"
[tagname name fields interfaces methods]
- (let [classname (with-meta (symbol (str *ns* "." name)) (meta name))]
+ (let [classname (with-meta (symbol (str (namespace-munge *ns*) "." name)) (meta name))]
`(deftype* ~tagname ~classname ~fields
:implements ~interfaces
~@methods)))
@@ -384,7 +384,7 @@
[name [& fields] & opts+specs]
(let [gname name
[interfaces methods opts] (parse-opts+specs opts+specs)
- classname (symbol (str *ns* "." gname))
+ classname (symbol (str (namespace-munge *ns*) "." gname))
tag (keyword (str *ns*) (str name))
hinted-fields fields
fields (vec (map #(with-meta % nil) fields))]
@@ -519,7 +519,7 @@
(str "function " (.sym v)))))))))
(defn- emit-protocol [name opts+sigs]
- (let [iname (symbol (str (munge *ns*) "." (munge name)))
+ (let [iname (symbol (str (munge (namespace-munge *ns*)) "." (munge name)))
[opts sigs]
(loop [opts {:on (list 'quote iname) :on-interface iname} sigs opts+sigs]
(condp #(%1 %2) (first sigs)
diff --git a/test/clojure/test_clojure/protocols.clj b/test/clojure/test_clojure/protocols.clj
index d208c5fd..32cca655 100644
--- a/test/clojure/test_clojure/protocols.clj
+++ b/test/clojure/test_clojure/protocols.clj
@@ -101,12 +101,12 @@
(deftest illegal-extending
(testing "you cannot extend a protocol to a type that implements the protocol inline"
(is (fails-with-cause? IllegalArgumentException #".*HasProtocolInline already directly implements interface"
- (eval '(extend clojure.test-clojure.protocols.HasProtocolInline
+ (eval '(extend clojure.test_clojure.protocols.HasProtocolInline
clojure.test-clojure.protocols.examples/ExampleProtocol
{:foo (fn [_] :extended)})))))
(testing "you cannot extend to an interface"
(is (fails-with-cause? IllegalArgumentException #"interface clojure.test_clojure.protocols.examples.ExampleProtocol is not a protocol"
- (eval '(extend clojure.test-clojure.protocols.HasProtocolInline
+ (eval '(extend clojure.test_clojure.protocols.HasProtocolInline
clojure.test_clojure.protocols.examples.ExampleProtocol
{:foo (fn [_] :extended)}))))))