Javascript call to String.join within ant returns a String and not an Array
<p>I'm trying to build the symettrical difference of two ";" seperated lists in my ant file. But it doesn't work and I think it might be because the result of String.split(";") seems to be a string, not an Array. (As seen in the println(a1). The result is: [Ljava.lang.String;@6395e579).</p>

<p>See the code:

</p>

<pre><code>&lt;scriptdef language="javascript" name="diffLists"&gt;
    &lt;attribute name="list1" /&gt;
    &lt;attribute name="list2" /&gt;
    &lt;attribute name="target" /&gt;
    &lt;![CDATA[
          function symmetricDifference(str1, str2) {
                var a1 = str1.split(";");
                println(Array.isArray(a1));
                println(a1);
                var a2 = str2.split(";");

              var result = [];
              for (var i = 0; i &lt; a1.length; i++) {
                if (a2.indexOf(a1[i]) == -1) {
                  result.push(a1[i]);
                }
                }
                for (i = 0; i &lt; a2.length; i++) {
                  if (a1.indexOf(a2[i]) == -1) {
                    result.push(a2[i]);
                  }
                }
                return result;
            }

          project.setProperty(attributes.get("target"),symmetricDifference(attributes.get("list1"),attributes.get("list2")).join(";"));
   ]]&gt;
  &lt;/scriptdef&gt;

&lt;target name="init"&gt;
    &lt;taskdef resource="net/sf/antcontrib/antlib.xml"&gt;
      &lt;classpath&gt;
        &lt;pathelement location="${basedir}/lib/ant-contrib-1.0b3.jar"/&gt;
      &lt;/classpath&gt;
    &lt;/taskdef&gt;
&lt;/target&gt;

&lt;target name="checkDiff" depends="init"&gt;
 &lt;var name="fileOld.list" value="a.txt;b.txt" /&gt;
 &lt;var name="file.list" value="b.txt;c.txt" /&gt;
 &lt;diffLists list1="${fileOld.list}" list2="${file.list}" target="diffList" /&gt;
 &lt;echo message="DIFF: ${diffList}" /&gt;
&lt;/target&gt;
</code></pre>

<p></p>

<p>It is supposed to return: a.txt;c.txt
But it returns: a.txt;b.txt;b.txt;c.txt</p>

<p>I'm using Apache Ant(TM) version 1.9.2 compiled on July 8 2013 if that matters.</p>

<p>Thank you for your help!</p>