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

problem compiling @Delegate to an interface that extends another interface

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.4, 1.7.5, 1.8-beta-3
    • 1.7.7, 1.8-beta-4
    • Compiler
    • None

    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.

      Attachments

        1. Groovy4619.patch
          1 kB
          Paul King

        Activity

          People

            paulk Paul King
            brownj Jeff Brown
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: