[ 
https://issues.apache.org/jira/browse/GROOVY-10978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-10978.
------------------------------

> LUB of Type<T extends Something> and Type<? extends Something>
> --------------------------------------------------------------
>
>                 Key: GROOVY-10978
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10978
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.21, 3.0.16, 4.0.10
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 2.5.22, 3.0.17, 4.0.11
>
>
> Follow up to GROOVY-10756.  Blending wildcard and unresolved parameterized 
> type is incomplete.
> Consider the following:
> {code:groovy}
>             interface Handle {
>                 int getCount()
>             }
>             class HandleContainer<H extends Handle> {
>                 H handle
>             }
>             interface Input {
>                 HandleContainer<? extends Handle> getResult(key)
>             }
>             interface State {
>                 def <X extends Handle> HandleContainer<X> getResult(key)
>             }
>             void test(Input input, State state) {
>                 def container = state.getResult('k') ?: input.getResult('k') 
> // HERE: HandleContainer<# extends Handle> and HandleContainer<? extends 
> Handle>
>                 Handle handle = container.handle
>                 Integer count = handle.count
>                 assert count == 1
>             }
>             Handle h = {->1}
>             def c = new HandleContainer(handle: h)
>             test({k->c} as Input, {k->c} as State)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to