groovy
  1. groovy
  2. GROOVY-3611

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

    Details

    • Type: Bug Bug
    • Status: Closed 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)
    • Number of attachments :
      0

      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

        Hide
        Dan Hinojosa added a comment -

        This came back as of 1.6.3

        Show
        Dan Hinojosa added a comment - This came back as of 1.6.3
        Hide
        Roshan Dawrani added a comment -

        I am unable to reproduce the issue on both 1.6.4 and 1.7-beta-1 dev branches.

        GROOVY-3129 (whose clone the current JIRA) is, was fixed much before 1.5.8/1.6.1 release and the exact test case
        provided in that has been part of groovy test suite since then and it is still going through.

        So, can you double check your environment and verify the version of groovy being used,etc?

        Show
        Roshan Dawrani added a comment - I am unable to reproduce the issue on both 1.6.4 and 1.7-beta-1 dev branches. GROOVY-3129 (whose clone the current JIRA) is, was fixed much before 1.5.8/1.6.1 release and the exact test case provided in that has been part of groovy test suite since then and it is still going through. So, can you double check your environment and verify the version of groovy being used,etc?
        Hide
        Roshan Dawrani added a comment -

        Hi,
        Could you confirm the groovy version you are using when you get this error? Otherwise, I am planning to mark it as "Cannot reproduce" as on both 1.6.x an d 1.7.x, what you have reported is working.

        Thanks,
        Roshan

        Show
        Roshan Dawrani added a comment - Hi, Could you confirm the groovy version you are using when you get this error? Otherwise, I am planning to mark it as "Cannot reproduce" as on both 1.6.x an d 1.7.x, what you have reported is working. Thanks, Roshan
        Hide
        Roshan Dawrani added a comment -

        I have verified on 1.6.0, 1.6.4 and 1.7.-beta-1 (with JDK 1.5) and I don't see the anywhere. This test case is also present in groovy's test suite and runs on configurations that cover JDK 1.4, 1.5, 1.6 and it's not failing anywhere there also.

        Still, if you confirm after checking out your environment that you are seeing the issue, please re-open this one. For now, there is nothing to be done unless you come back otherwise.

        Show
        Roshan Dawrani added a comment - I have verified on 1.6.0, 1.6.4 and 1.7.-beta-1 (with JDK 1.5) and I don't see the anywhere. This test case is also present in groovy's test suite and runs on configurations that cover JDK 1.4, 1.5, 1.6 and it's not failing anywhere there also. Still, if you confirm after checking out your environment that you are seeing the issue, please re-open this one. For now, there is nothing to be done unless you come back otherwise.
        Hide
        Dan Hinojosa added a comment -

        No problem. I still have this error here on 1.6.3. It is a java superclass and a groovy subclass where I have this issue. I just haven't had time to reconstruct a simple case.

        Show
        Dan Hinojosa added a comment - No problem. I still have this error here on 1.6.3. It is a java superclass and a groovy subclass where I have this issue. I just haven't had time to reconstruct a simple case.
        Hide
        Dan Hinojosa added a comment -

        Made a small example and it works. Hmmm. The project I have is Jboss Seam application, and I am extending a generic java class in groovy. Maybe the joint compiler has something to do with it. Will verify.

        Show
        Dan Hinojosa added a comment - Made a small example and it works. Hmmm. The project I have is Jboss Seam application, and I am extending a generic java class in groovy. Maybe the joint compiler has something to do with it. Will verify.
        Hide
        Roshan Dawrani added a comment -

        If you are able to reproduce your error with a groovy class extending a java class and getting this error, then it will
        be good if you can report it as a separate JIRA as then this JIRA won't exactly be a clone of GROOVY-3129

        There may be some different issue I groovy compiler where it does generics checks for base classes.
        GROOVY-3129 involved generics checks involving interfaces. Not to bother you too much with internals, but if use case is
        different, then a separate JIRA please. Thanks.

        Show
        Roshan Dawrani added a comment - If you are able to reproduce your error with a groovy class extending a java class and getting this error, then it will be good if you can report it as a separate JIRA as then this JIRA won't exactly be a clone of GROOVY-3129 There may be some different issue I groovy compiler where it does generics checks for base classes. GROOVY-3129 involved generics checks involving interfaces. Not to bother you too much with internals, but if use case is different, then a separate JIRA please. Thanks.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: