groovy
  1. groovy
  2. GROOVY-4974

Bounded generics do not work with inheritance

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.3, 1.9-beta-4
    • Component/s: Compiler
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      The following code works in Java, but fails to compile in Groovy - looks like unintentional:

      public class TestGenerics { 
          static interface Z {} 
          static class X implements Z {} 
          static class Y extends X {} 
      
          static class A <T extends Z> { void a(T t) { System.out.println(t); } } 
          static class B extends A<Y> {} 
          static class C extends A<X> {} 
      
          public static void main(String[] args) { 
              new C().a(new Y()); 
          } 
      } 
      

        Activity

          People

          • Assignee:
            Paul King
            Reporter:
            Dimitar Dimitrov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: