Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.1, 3.0.2, 3.0.3
-
None
-
None
Description
While upgrading GORM for Neo4j to support Groovy 3, we are seeing an issue with generics as:
[Static type checking] - Cannot return value of type grails.neo4j.Path$Segment <S, E> on method returning type T @ line 81, column 16. return end ^ 1 error
I believe the problem is with using same name of type argument in the Generics for multiple classes as in the following code:
import groovy.transform.CompileStatic import java.util.function.Consumer @CompileStatic abstract class Path<F extends Neo4jEntity, T extends Neo4jEntity> implements Iterable<Segment<F,T>> { T end interface Segment<F, T> { F start() T end() } abstract F start() T end() { return end } @Override void forEach(Consumer<? super Segment<F, T>> action) { } @Override Spliterator<Segment<F, T>> spliterator() { return null } @Override Iterator<Segment<F, T>> iterator() { return null } } trait Neo4jEntity<D> { } println GroovySystem.version
Please note that If we replace `F` and `T` in the above code with `S` and `E` the code will compile successfully.