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

CS: Loop over elements of String has different element type

    Details

      Description

      When the method below is executed as-is, the output is "java.lang.String" x3. When @CompileStatic is uncommented, the output is "java.lang.Character" x3. Is it possible to have dynamic groovy match the static compilation result?

      //@groovy.transform.CompileStatic
      void meth() {
        for (c in 'abc')
          println c.class.name
      }
      

      Similarly, 'abc'*.anything applies to Strings of length one instead of Characters. Although, spread-dot is not supported against strings under static compilation. Is it possible to add that support?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                emilles Eric Milles
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: