You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Jochen Kemnade (JIRA)" <ji...@apache.org> on 2013/12/03 15:49:37 UTC

[jira] [Created] (TAP5-2248) ClojureBuilder should support bridging varargs methods

Jochen Kemnade created TAP5-2248:
------------------------------------

             Summary: ClojureBuilder should support bridging varargs methods
                 Key: TAP5-2248
                 URL: https://issues.apache.org/jira/browse/TAP5-2248
             Project: Tapestry 5
          Issue Type: Improvement
          Components: tapestry-clojure
    Affects Versions: 5.4
            Reporter: Jochen Kemnade


ClojureBuilder fails to bridge varargs methods to Clojure functions, e.g.
{code}
@FunctionName("clojure.core/+")
Number plus(Number ... numbers);
{code}
Invoking the method leads to 
{code}
java.lang.ClassCastException: Cannot cast [Ljava.lang.Number; to java.lang.Number
	at java.lang.Class.cast(Class.java:3084)
	at clojure.core$cast.invoke(core.clj:325)
	at clojure.core$_PLUS_.invoke(core.clj:943)
	at clojure.lang.Var.invoke(Var.java:415)
	at org.apache.tapestry5.clojure.tests.ClojureBuilderSpec.invoke a method with a variable number of arguments(ClojureBuilderSpec.groovy:50)
{code}
We could check {code}java.lang.reflect.Method.isVarArgs(){code} and "unwrap" the last parameter array or some mixture of  {code}clojure.lang.IFn.applyTo(ISeq){code} and {code}clojure.core/conj{code} for the invocation.



--
This message was sent by Atlassian JIRA
(v6.1#6144)