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

Traits aren't detected as implementing abstract methods

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0-beta-1
    • 2.3.0-beta-2
    • Compiler
    • None

    Description

      If you have an abstract class, and then implement the abstract methods via a trait, eg:

      abstract class AbstractSomething {
          abstract void something()
      }
      
      trait SomethingDoing {
          void something() {
             println "Doing something"
          }
      }
      
      class Something extends AbstractSomething implements SomethingDoing {
          void foo() {
              something()
          }
      }
      
      new Something().foo()
      

      Rather than the expected output Doing something we get:

      Can't have an abstract method in a non-abstract class. The class 'Something' must be declared abstract or the method 'void something()' must be implemented.
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            tim_yates Tim Yates
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: