On Fri, 7 Nov 2008, Stuart Halloway <[EMAIL PROTECTED]> wrote:

> (2) Help me interpret the error in reflectively defining the Ant
>       tasks (commented out lines at the bottom of lancet/ant/ant.clj

I don't have a working Clojure environment yet, so I've done a few
things with the REPL and copy-paste of ant.clj.

I get a Clojure compilation error[1] if I use the define-ant-task
macro as you do in our commented code.  If I manually expand
define-ant-task I get the expected exception from <fail> (that's what
you get when running that task):

user=> (doseq td (.getTaskDefinitions ant-project) (do (.execute 
(instantiate-task ant-project (.getKey td)))))
No message
No message
        at org.apache.tools.ant.taskdefs.Exit.execute(Exit.java:142)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:82)
        at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:245)
        at user.eval__2359.invoke(Unknown Source)
        at clojure.lang.Compiler.eval(Compiler.java:3891)
        at clojure.lang.Repl.main(Repl.java:75)

I don't think you really want to execute the freshly defined task
right away as the macro currently does.

Stefan

[1]

Caused by: java.lang.InstantiationException: user.eval__2345$eval__2347
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at clojure.lang.Compiler$FnExpr.eval(Compiler.java:3029)
        at clojure.lang.Compiler.eval(Compiler.java:3890)
        at clojure.eval__736.invoke(boot.clj:1389)
        at user.define_ant_task__2310.invoke(Unknown Source)
        at clojure.lang.Var.invoke(Var.java:319)
        at clojure.lang.AFn.applyToHelper(AFn.java:184)
        at clojure.lang.Var.applyTo(Var.java:436)
        at clojure.lang.Compiler.macroexpand1(Compiler.java:3781)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:3846)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to