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

Error implementing a Java or Groovy generic interface

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.3
    • 1.8.5, 2.0-beta-2, 1.7.11
    • None
    • None
    • Groovy 1.7.3 - Eclipse

    Description

      Hello.

      I have an issue creating a Groovy class implementing an interface coded in Java with Generics:
      Here is the code:

      /* Java interface */
      public interface Entity<T> {
      	T getId();	
      }
      
      /* Groovy class */
      class Car implements Entity<Long> {
            Long id;
      }
      

      Car groovy class has a Long getId() method already, but it doesn't recognize it's enough to implement the interface method:
      "Can't have an abstract method in a non-abstract class. The class 'Car' must be declared abstract or the method 'java.lang.Object getId()' must be implemented."

      The same happens when the interface is coded in Groovy instead of Java.

      I believe it's an important thing to support.

      I am using Groovy 1.7.3.

      Thank you.

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              lucianogreiner Luciano Greiner
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: