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

println requires parentheses when new is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-3
    • None
    • None
    • Windows

    Description

      In the following code, the first line results in a call to MyClass.toString, but the second doesn't.
      Notice that the only difference is whether parentheses are used.

      println(new MyClass(a:1))
      println new MyClass(a:2)

      class MyClass {
      a
      String toString() { "a = ${a}" }
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            mvolkmann R. Mark Volkmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: