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

Class constructor problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0-beta-9
    • 1.0-JSR-6
    • None
    • None
    • Windows XP

    Description

      The default constructor in class Point gives rise to the
      following error:

      Caught: groovy.lang.MissingMethodException: No signature of method
      Point.doCall() is applicable for argument types: (java.lang.Integer, java.lang.Integer)
      values: [0, 0]

      class Point {

      Point(x, y)

      { this.x = x this.y = y }

      Point()

      { this(0, 0) // PROBLEM HERE }

      // ---------- properties ----------------------------------

      x
      y
      }

      pp = new Point(1, 2)
      qq = new Point()

      println "pp: ${pp.x} ${pp.y}"
      println "qq: ${qq.x} ${qq.y}"

      Attachments

        1. bug03.groovy
          0.7 kB
          Kenneth Bell

        Activity

          People

            blackdrag Jochen Theodorou
            kenb Kenneth Bell
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: