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

CLONE - collectEntries throws cryptic error when used with split(delimiter, limit)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.4.6
    • Component/s: None
    • Labels:
      None
    • Environment:
      Java 7, 8 - all versions
      MacOS
    • Flags:
      Patch

      Description

      Here is my code

      def cityList = '''\
      1 San Francisco
      2 Cupertino
      '''
      def cityMap = cityList.split('\n').
          collectEntries{ it.split(' ', 2).toList() }
          
      def cityMap2 = cityList.split('\n').
          collectEntries{ it.split(' ', 2) }
      

      I initially only tried the second approach, and got an exception that was rather hard to debug:

      Exception thrown
      
      java.lang.ClassFormatError: Illegal class name "String;4_groovyProxy" in class file String;4_groovyProxy
      	at ConsoleScript6.run(ConsoleScript6:8)
      

      Gold would be if Groovy deals with this out of the box.
      Silver would be if the error message told me what was wrong.

      The link to the discussion is here - http://groovy.329449.n5.nabble.com/Illegal-class-name-String-1-groovyProxy-tp5728011.html

      Note

      Issue split - this part is to handle the incorrect naming for arrays with ProxyGeneratorAdapter

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                rahulsom Rahul Somasunderam
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: