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

this() does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-1
    • None
    • None
    • N/A

    Description

      When trying to use this() to call a constructor from another constructor, an exception is raised about the signatures of the call() method.

      Groovy permits using default parameters in a constructor, which provides an alternative approach here, but it is not generally as good as cross-calling, as it can result in duplicated code.

      e.g.

      class A {
      A (String a)

      { ... }

      A ()

      { this("foo"); }

      }

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            garrow John Redford
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: