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

Traits should allow to use @Override for method implemented from interface

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4.0-beta-4
    • 2.3.9, 2.4.0-rc-1
    • Compiler
    • None

    Description

      Currently for the following code:

      interface MyInterface {
          void myMethod()
      }
      trait MyTrait implements MyInterface {
          @Override void myMethod() { ... }
      }
      

      the compiler reports:

      Method 'onUrl' from class 'MyTraitTrait$Helper' does not override method from its superclass or interfaces but is annotated with @Override.
       @ line 9, column 5.
             @Override
             ^
      
      1 error
      

      It would make it harder to mismatch a overridden method signature.

      Attachments

        Activity

          People

            melix Cédric Champeau
            szpak Marcin Zajaczkowski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: