From ec0e40ed19fc8876fb7ef2048b625ba554727086 Mon Sep 17 00:00:00 2001 From: Sam Ritchie Date: Wed, 14 Dec 2011 14:43:26 -0800 Subject: [PATCH] Workaround to Clojure 1.2 reader bug The clojure 1.2 reader will allow invalid forms like {:key} to be read in, and only throw an exception on printing. Currently clojure.tools.namespace calls (read rdr) within a try form; the bug means that this particular type of error is never caught. This patch forces the reader to try and resolve with str, allowing clojure.tools.namespace to catch and bury the error. Technomancy had to do something similar in leiningen: https://github.com/technomancy/leiningen/commit/7dc1b034ee --- src/main/clojure/clojure/tools/namespace.clj | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/main/clojure/clojure/tools/namespace.clj b/src/main/clojure/clojure/tools/namespace.clj index 8712f6f..27d5be3 100644 --- a/src/main/clojure/clojure/tools/namespace.clj +++ b/src/main/clojure/clojure/tools/namespace.clj @@ -55,7 +55,7 @@ in the file, except for (comment ...) forms." [^PushbackReader rdr] (try - (loop [] (let [form (read rdr)] + (loop [] (let [form (doto (read rdr) str)] (cond (ns-decl? form) form (comment? form) (recur) -- 1.7.4.2