Permalink
Browse files

Attempt to compile on Clojure 1.2

  • Loading branch information...
1 parent 6dd61f5 commit f534bf51f597caa475467f6c646a3497e234d976 @seancorfield seancorfield committed Feb 14, 2012
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/main/clojure/clojure/java/data.clj
@@ -101,7 +101,17 @@
(apply setter [instance value]))))
instance))
-(defmethod to-java [BigInteger Object] [_ value] (biginteger value))
+;; feature testing macro, based on suggestion from Chas Emerick:
+(defmacro when-available
+ [sym & body]
+ (try
+ (when (resolve sym)
+ (list* 'do body))
+ (catch ClassNotFoundException _#)))
+
+(when-available
+ biginteger
+ (defmethod to-java [BigInteger Object] [_ value] (biginteger value)))
;; common from-java definitions

0 comments on commit f534bf5

Please sign in to comment.