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

Traits don't like generic arguments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.6
    • 2.3.7
    • Compiler
    • None

    Description

      This compiles:

      trait Foo { public <T> T  bar(def a) { a } }
      class Bar implements Foo {}
      

      This doesn't:

      trait Foo { public <T> T  bar(T a) { a } }
      class Bar implements Foo {}
      

      But this does:

      trait Foo<X> { public <T> T  bar(T a) { a } }
      class Bar implements Foo {}
      

      But this doesn't:

      trait Foo<X> { public <T> T  bar(T a) { a } }
      class Bar implements Foo<String> {}
      

      This does, though it doesn't make sense:

      trait Foo<X> { public <T> T  bar(X a) { a } }
      class Bar implements Foo<String> {}
      

      Attachments

        Activity

          People

            melix C├ędric Champeau
            ddimitrov Dimitar Dimitrov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: