You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Puneet Behl (Jira)" <ji...@apache.org> on 2020/04/09 17:35:00 UTC
[jira] [Created] (GROOVY-9500) Goorvy 3 Compilation Failure issue
with Generics
Puneet Behl created GROOVY-9500:
-----------------------------------
Summary: Goorvy 3 Compilation Failure issue with Generics
Key: GROOVY-9500
URL: https://issues.apache.org/jira/browse/GROOVY-9500
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 3.0.3, 3.0.2, 3.0.1
Reporter: Puneet Behl
While upgrading GORM for Neo4j to support Groovy 3, we are seeing an issue with generics as:
{code:java}
[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
{code}
I believe the problem is with using same name of type argument in multiple classes as in the following code:
{code:java}
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
{code}
*Please note that* If we replace `F` and `T` in the above code with `S` and `E` the code will compile successfully.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)