You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/03/17 16:35:00 UTC
[jira] [Created] (GROOVY-10978) LUB of Type and Type extends Something>
Eric Milles created GROOVY-10978:
------------------------------------
Summary: 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
Reporter: Eric Milles
Assignee: Eric Milles
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)