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

Bounded generics do not work with inheritance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.8.3, 1.9-beta-4
    • Compiler
    • None

    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()); 
          } 
      } 
      

      Attachments

        Activity

          People

            paulk Paul King
            ddimitrov Dimitar Dimitrov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: