groovy
  1. groovy
  2. GROOVY-4658

CLONE -problem compiling @Delegate to an interface that extends another interface (handle default args case)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.4, 1.7.5, 1.8-beta-3
    • Fix Version/s: 1.8.4, 2.0-beta-1, 1.7.11
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The following code compiles with 1.7.3 but fails with 1.7.4, 1.7.5 and 1.8.0-beta-3.

      SomeInterface.groovy
      interface SomeInterface {
          void doSomething()
      }
      
      SomeOtherInterface.groovy
      interface SomeOtherInterface extends SomeInterface {}
      
      SomeClass.groovy
      class SomeClass {
          @Delegate
          SomeOtherInterface someOtherInterface
      }
      

      Compiling with 1.7.3:

       $ groovy -version
      Groovy Version: 1.7.3 JVM: 1.6.0_22
       $ groovyc SomeClass.groovy 
       $ 
      

      Compiling with 1.7.4:

       $ groovy -version
      Groovy Version: 1.7.4 JVM: 1.6.0_22
       $ groovyc SomeClass.groovy 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      SomeClass.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'void doSomething()' must be implemented.
       @ line 1, column 1.
         class SomeClass {
         ^
      
      1 error
      
       $ 
      

      Compiling with 1.7.5:

       $ groovy -version
      Groovy Version: 1.7.5 JVM: 1.6.0_22
       $ groovyc SomeClass.groovy 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      SomeClass.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'void doSomething()' must be implemented.
       @ line 1, column 1.
         class SomeClass {
         ^
      
      1 error
      
       $ 
      

      Compiling with 1.8.0-beta-3:

       $ groovy -version
      Groovy Version: 1.8.0-beta-3 JVM: 1.6.0_22
       $ groovyc SomeClass.groovy 
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      SomeClass.groovy: 1: Can't have an abstract method in a non-abstract class. The class 'SomeClass' must be declared abstract or the method 'void doSomething()' must be implemented.
       @ line 1, column 1.
         class SomeClass {
         ^
      
      1 error
      
       $ 
      

      This may be related to GROOVY-4163.

        Activity

        Hide
        CÚdric Champeau added a comment -

        Under Groovy 1.8.3, it returns a different error:

        groovyc SomeClass.groovy 
        org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
        SomeClass.groovy: 2: unable to resolve class SomeOtherInterface 
         @ line 2, column 5.
               SomeOtherInterface someOtherInterface
               ^
        
        1 error
        

        But using groovyc *.groovy, it works.

        Show
        CÚdric Champeau added a comment - Under Groovy 1.8.3, it returns a different error: groovyc SomeClass.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: SomeClass.groovy: 2: unable to resolve class SomeOtherInterface @ line 2, column 5. SomeOtherInterface someOtherInterface ^ 1 error But using groovyc *.groovy, it works.
        Hide
        blackdrag blackdrag added a comment -

        fixed in many cases. It seems not to work for me locally, but we have confirmed it works for many others

        Show
        blackdrag blackdrag added a comment - fixed in many cases. It seems not to work for me locally, but we have confirmed it works for many others

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Jeff Scott Brown
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: