Groovy
  1. Groovy
  2. GROOVY-3611

CLONE -Compile-error when implementing a method from a generic interface

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6-beta-1, 1.5.7, 1.6-beta-2
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.6.4, 1.7-beta-1
    • Component/s: None
    • Labels:
      None
    • Environment:
      sun java 1.6.0_u10, Linux (2.6.24)

      Description

      This code works under 1.5.6 but not with newer versions.

      Test-Code:

      class Test {
          static void main( args ) {
              Task t = new Task()
              List l = t.myCall()
              println l.dump()
          }
      }
      
      interface MyCallable<T> {
          T myCall() throws Exception;
      }
      
      class Task implements MyCallable<List> {
          List myCall() throws Exception {
              return [ 42 ]
          }
      }
      

      results in:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, /home/lukas/temp/groovytest2.groovy: 14: the return type is incompatible with java.lang.Object myCall() in MyCallable.
      Node: org.codehaus.groovy.ast.MethodNode. At [14:5]  @ line 14, column 5.
             List myCall() throws Exception {
             ^
      

        Activity

        Daniel Hinojosa created issue -
        Roshan Dawrani made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.6.4 [ 15291 ]
        Resolution Cannot Reproduce [ 5 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732600 ] Default workflow, editable Closed status [ 12744423 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970378 ] Default workflow, editable Closed status [ 12978166 ]

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Daniel Hinojosa
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development