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

Strange compilation error with an "as" cast and a nested generics map

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.8.6, 2.4.7
    • Fix Version/s: None
    • Component/s: parser
    • Labels:
      None
    • Environment:
      *

      Description

      Bad Groovy
      def myMap = [:] as Map<String, Map<String,String>>
      def foo = ''
      

      tells:

      Error
      1 compilation error:
      
      expecting EOF, found 'def' at line: 2, column: 1
      

      but:

      Good Groovy
      def myMap = [:] as Map<String, Map<String,String> >
      def bar = ''
      

      works fine.

      Difference lies between >> and > > (with space).

      Fix "Bad Groovy" assignment.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                daniel_sun Daniel Sun
                Reporter:
                MaikIgloffstein Maik Igloffstein
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: