[ https://issues.apache.org/jira/browse/GROOVY-10472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phaninra updated GROOVY-10472: ------------------------------ Description: {code:java} @AutoImplement{code} is failing when (Java) covariant returns are involved. Copy the following into GroovyConsole and hit run to reproduce the error. {code:java} import groovy.transform.*@CompileStatic interface Super { Iterable findAll() } @CompileStatic interface Sub extends Super { List findAll() // a List instead of an Iterable } @AutoImplement @CompileStatic class ThisClassFails implements Sub, Super {} {code} Error will look like {code:java} 1 compilation error: The return type of java.lang.Iterable findAll() in ThisClassFails is incompatible with java.util.List in Sub . At [14:1] at line: 14, column: 1 {code} Refs: - Real life example: [https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaRepository.html] Look at all variations of `findAll` methods in that interface and super - some use Iterable and some use List. - Covariant return type : [https://www.javatpoint.com/covariant-return-type] was: `@AutoImplement` is failing when (Java) covariant returns are involved. Copy the following into GroovyConsole and hit run to reproduce the error. {code:java} import groovy.transform.*@CompileStatic interface Super { Iterable findAll() } @CompileStatic interface Sub extends Super { List findAll() // a List instead of an Iterable } @AutoImplement @CompileStatic class ThisClassFails implements Sub, Super {} {code} Error will look like {code:java} 1 compilation error: The return type of java.lang.Iterable findAll() in ThisClassFails is incompatible with java.util.List in Sub . At [14:1] at line: 14, column: 1 {code} Refs: - Real life example: [https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaRepository.html] Look at all variations of `findAll` methods in that interface and super - some use Iterable and some use List. - Covariant return type : https://www.javatpoint.com/covariant-return-type > @AutoImplement is failing when covariant returns are involved > ------------------------------------------------------------- > > Key: GROOVY-10472 > URL: https://issues.apache.org/jira/browse/GROOVY-10472 > Project: Groovy > Issue Type: Bug > Components: Compiler > Reporter: Phaninra > Priority: Major > > {code:java} > @AutoImplement{code} > is failing when (Java) covariant returns are involved. > > Copy the following into GroovyConsole and hit run to reproduce the error. > {code:java} > import groovy.transform.*@CompileStatic > interface Super { > Iterable findAll() > } > @CompileStatic > interface Sub extends Super { > List findAll() // a List instead of an Iterable > } > @AutoImplement > @CompileStatic > class ThisClassFails implements Sub, Super {} {code} > > Error will look like > {code:java} > 1 compilation error: > The return type of java.lang.Iterable findAll() in ThisClassFails is > incompatible with java.util.List in Sub > . At [14:1] at line: 14, column: 1 {code} > > Refs: > - Real life example: > [https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaRepository.html] > Look at all variations of `findAll` methods in that interface and super - > some use Iterable and some use List. > - Covariant return type : [https://www.javatpoint.com/covariant-return-type] > > -- This message was sent by Atlassian Jira (v8.20.1#820001)