Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5061

Incorrect translation of class property which type has array as enclosed type argument

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.2
    • 1.8.5, 2.0-beta-2, 1.7.11
    • None

    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>
      

      Attachments

        1. ant_error.txt
          13 kB
          Alexander Monakhov

        Activity

          People

            melix Cédric Champeau
            almo Alexander Monakhov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: