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

aStringBuffer + anObject gives runtime error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-6
    • 1.0-beta-8
    • None
    • None
    • All

    Description

      From <oni> on #groovy
      >
      >
      > println ( buffer + key + value);
      >
      > results in an error of No signature of method
      > java.lang.StringBuffer.plus() is applicable
      >
      > buffer is of type StringBuffer
      > if i use buffer.toString()
      > it works fine

      I assume the java compiler turns all the (buffer + key + value) into (buffer.append(key).append(value))
      but the groovy plus() isn't quite as smart...?
      either a compiler change, or a new DGM plus method perhaps..?

      Thanks for this oni.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            jez Jeremy Rayner
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: