groovy
  1. groovy
  2. GROOVY-5061

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

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.5, 2.0-beta-2, 1.7.11
    • Labels:
      None
    • Environment:
    • Number of attachments :
      1

      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>
      
      1. ant_error.txt
        13 kB
        Alexander Monakhov

        Activity

        Hide
        blackdrag blackdrag added a comment -

        Paul, didn't we fix this recently?

        Show
        blackdrag blackdrag added a comment - Paul, didn't we fix this recently?
        Hide
        Alexander Monakhov added a comment -

        Guys, any progress on this issue?

        Show
        Alexander Monakhov added a comment - Guys, any progress on this issue?

          People

          • Assignee:
            CÚdric Champeau
            Reporter:
            Alexander Monakhov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: