[
https://issues.apache.org/jira/browse/GROOVY-10646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-10646:
---------------------------------
Fix Version/s: 4.0.5
(was: 5.0.0-alpha-1)
> STC: outer class type parameter inference
> -----------------------------------------
>
> Key: GROOVY-10646
> URL: https://issues.apache.org/jira/browse/GROOVY-10646
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 4.0.5
>
>
> Consider the following (extracted from mybatis SelectDSLCompleter):
> {code:groovy}
> class Model {
> }
> interface Output<T> {
> T build()
> }
> abstract class Input<T> extends QueryDSL<Inner> implements Output<T> {
> class Inner implements Output<T> {
> @Override T build() { }
> }
> }
> abstract class QueryDSL<X> {
> abstract X where()
> }
> @FunctionalInterface
> interface Func extends Function<Input<Model>, Output<Model>> {
> }
> void select(Func func) {
> }
> @groovy.transform.TypeChecked
> void test() {
> select { input -> input.where() } // Cannot return value of type Inner for
> closure expecting Output<Model>
> }
> {code}
> "input" is inferred correctly to be of type "Input<Model>" which should lead
> to an "Inner" return type for "where()" that implements "Output<Model>".
> Some context is lost along the way and "Output<Object>" is inferred instead.
> https://github.com/groovy/groovy-eclipse/issues/1364
--
This message was sent by Atlassian Jira
(v8.20.10#820010)