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

Fail to compile when there is a method return List<int[]>

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.4
    • 1.6-beta-1, 1.5.7
    • None
    • JDK 6, Groovy 1.5.4, Grails 1.0.2

    Description

      For a simple class with a method that return a List<int[]>, i.e.
      class Tester{
      List<int[]> getList()

      { return [[0,0] as int[]]; }

      }

      It cannot compile. the following are error message:
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: illegal start of type
      public java.util.List<[I> getList()

      { return (java.util.List<[I>)null;}
      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: ';' expected
      public java.util.List<[I> getList() { return (java.util.List<[I>)null;}

      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: invalid method declaration; return type required
      public java.util.List<[I> getList()

      { return (java.util.List<[I>)null;}
      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: illegal start of expression
      public java.util.List<[I> getList() { return (java.util.List<[I>)null;}

      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: ';' expected
      public java.util.List<[I> getList()

      { return (java.util.List<[I>)null;}
      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: illegal start of expression
      public java.util.List<[I> getList() { return (java.util.List<[I>)null;}

      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: ';' expected
      public java.util.List<[I> getList()

      { return (java.util.List<[I>)null;}
      ^
      C:\Documents and Settings\USERNAME\.grails\1.0.2\projects\test_grails\generated-java-source\Tester.java:13: not a statement
      public java.util.List<[I> getList() { return (java.util.List<[I>)null;}

      ^
      8 errors
      Compilation error: Compile failed; see the compiler error output for details.

      Notice that it's a Grails application and the compilation is done when i run grails run-app. It seems there is no problem when use IDEA to do unit test against the method.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mingfai Mingfai Ma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: