 
 (defn set-property! [inst prop value]
   (let [pd (property-descriptor inst prop)]
-    (throw-if (nil? pd) (str "No such property " prop))
+    (when-not pd
+      (throw (Exception. (format "No such property %s." prop))))
     (let [write-method (.getWriteMethod pd)
           dest-class (get-property-class write-method)]
       (.invoke write-method inst (into-array [(coerce dest-class value)])))))


(defn instantiate-task [project name props & filesets]
  (let [task (.createTask project name)]
    (throw-if (nil? task) (str "No task named " name))
    (doto task
      (.init)
      (.setProject project)
      (set-properties! props))
    (doseq [fs filesets]
      (.add task fs))
    task))

(defn runonce

(ns lancet.core
  (:gen-class)
  (:import (java.beans Introspector)
           (java.util.concurrent CountDownLatch)
           (org.apache.tools.ant.types Path)))

(def #^{:doc "Dummy ant project to keep Ant tasks happy"}
  ant-project
  (let [proj (org.apache.tools.ant.Project.)
        logger (org.apache.tools.ant.NoBannerLogger.)]
    (doto logger
      (.setMessageOutputLevel org.apache.tools.ant.Project/MSG_INFO)
      (.setEmacsMode true)
      (.setOutputPrintStream System/out)
      (.setErrorPrintStream System/err))
    (doto proj
      (.init)
      (.addBuildListener logger))))

(defmulti coerce (fn [dest-class src-inst] [dest-class (class src-inst)]))

