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

Traits aren't detected as implementing abstract methods

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0-beta-1
    • Fix Version/s: 2.3.0-beta-2
    • Component/s: Compiler
    • Labels:
      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

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              tim_yates Tim Yates
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: