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

Expression in string is expanded at the begin of the string, not where it is defined

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-beta-5
    • None
    • None
    • jdk1.4.2_02, WinXP, Groovy from CVS

    Description

      Consider the following snippet:

      arg = "test"
      content = "${arg} ="

      if (arg != "something")
      {
      content += "?"
      }

      content += "= ${arg}."

      println content

      This does result in the following output:

      test =?test= .

      The expression in the string added to 'content' was expanded at the beginning of the string.
      Strangely this does seem to have something to do with the if statement above it. If the string to which arg is compared to, is changed from "something" to "test", than the output is correct (i.e. test == test.)

      Attachments

        Activity

          People

            spullara Sam Pullara
            tomdz Thomas Dudziak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: