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

Can't @Override method with generic argument type in parameterized subclass

    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-1
    • Component/s: Compiler
    • Labels:
      None

      Description

      Base.groovy

      class Base<T> {
        void foo(T t) {}
      }
      

      Derived.groovy

      class Derived extends Base<String> {
        @Override
        void foo(String s) {}
      }
      

      Compile error:

      Error:(2, 3) Groovyc: Method 'foo' from class 'Derived' does not override method from its superclass or interfaces but is annotated with @Override.
      

      Removing the @Override annotation appears to solve the problem. Earlier Groovy versions (e.g. 2.0.x) didn't have this problem. Tested with latest groovy-all-2.3.0-SNAPSHOT.

        Attachments

          Activity

            People

            • Assignee:
              melix C├ędric Champeau
              Reporter:
              pniederw Peter Niederwieser
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: