Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8.2
-
None
-
{noformat}
amonakhov@marvin:~$ uname -a
Linux marvin 2.6.39-1-amd64 #1 SMP Tue May 24 14:34:19 UTC 2011 x86_64 GNU/Linux
amonakhov@marvin:~$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
amonakhov@marvin:~$ ant -version
Apache Ant(TM) version 1.8.2 compiled on September 22 2011
{noformat}{noformat} amonakhov@marvin :~$ uname -a Linux marvin 2.6.39-1-amd64 #1 SMP Tue May 24 14:34:19 UTC 2011 x86_64 GNU/Linux amonakhov@marvin :~$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode) amonakhov@marvin :~$ ant -version Apache Ant(TM) version 1.8.2 compiled on September 22 2011 {noformat}
Description
When compiling via Ant Groovyc task, the compiler generates erroneous Java from the two following files:
B.groovy
class B { Map<String, Map<String, Integer[]>> columnsMap = [:] }
C.java
public class C { public void f(B b) { System.out.println(b.getColumnsMap()); } }
Ant compilation results in many lines with the same error (full log attached):
[groovyc] /tmp/groovy-generated-2531065055182916850-java-source/B.java:16: ';' expected [groovyc] public java.util.Map<java.lang.String, java.util.Map<java.lang.String, [Ljava.lang.Integer;>> getColumnsMap() { return (java.util.Map<java.lang.String, java.util.Map<java.lang.String, [Ljava.lang.Integer;>>)null;}
Notes:
- if C.java is excluded from build, everything compiles fines.
- Eclipse plug-in compiles code fine too.
And if it's needed, the Ant task:
<target name="compile2" depends="check_java_version,prepare_libs"> <mkdir dir="temp_src/classes"/> <path id="groovy.class.path"> <fileset dir="${lib.dir}/groovy" includes="*.jar"/> </path> <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.class.path" /> <groovyc srcdir="temp_src" destdir="temp_src/classes" listfiles="yes" stacktrace="yes" verbose="yes"> <classpath refid="arms.class.path"/> <javac source="1.6" target="1.6"/> </groovyc> </target>