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

Problem with shadowing in an abstract class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0-RC-2
    • 1.1-rc-3
    • None
    • None
    • Windows XP
      Java 1.5.0

    Description

      When compiling a function with an argument of the same name as the function, and the function includes a closure, I get a "can't have abstract method in non-abstract class" message.

      bug17Interface.groovy:

      interface bug17Interface {
      void vars(Set vars)
      }

      bug17Abstract.groovy:

      abstract class bug17Abstract implements bug17Interface {
      void vars(Set vars) { [].each

      { it.vars(vars) }

      }
      }

      but17.groovy:

      class bug17 extends bug17Abstract { }

      typing "groovyc bug17.groovy" gives:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, bug17.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'bug17' must be declared abstract or the method 'vars' must be implemented.
      @ line 1, column 1.
      class bug17 extends bug17Abstract { }

      1 error

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mcspanky Martin C. Martin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: