Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.1, 2.1.0-beta-1
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      Windows 7 x64, Java 7 x64

      Description

      Don't know if this bug has been reported before (didn't find anything while looking)

      @CompileStatic
      class M
      {
      	public void r()
      	{
      		List<Integer> a = [1, 3, 5]
      		List<Integer> b = (List<Integer>)a[1..2]
      	}
      }
      
      (new M()).r()
      

      fails with

      D:\dev\eclipse_workspace\groovy_test\src\Test2.groovy: 13: [Static type checking] - Inconvertible types: cannot cast java.lang.Integer to java.util.List
       @ line 13, column 21.
         		List<Integer> b = (List<Integer>)a[1..2]
                             ^
      

      Thinks that the sublist is a single Integer

      Removing @CompileStatic fixes the problem

        Attachments

          Activity

            People

            • Assignee:
              Guillaume Guillaume Delcroix
              Reporter:
              gordon277 Gordon Brown
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: