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 2021/04/22 19:28:00 UTC
[jira] [Created] (GROOVY-10051) STC: return type for unresolved
placeholder with bound resolved to Object
Eric Milles created GROOVY-10051:
------------------------------------
Summary: STC: return type for unresolved placeholder with bound resolved to Object
Key: GROOVY-10051
URL: https://issues.apache.org/jira/browse/GROOVY-10051
Project: Groovy
Issue Type: Bug
Reporter: Eric Milles
Assignee: Eric Milles
Follow up from GROOVY-9033. Consider the following:
{code:groovy}
abstract class State<H extends Handle> {
// Why not return HandleContainer<H>? I can't really say.
def <T extends Handle> HandleContainer<T> getHandleContainer(key) {
}
}
class HandleContainer<H extends Handle> {
H handle
}
interface Handle {
Result getResult()
}
class Result {
int itemCount
String[] items
}
List<String> getStrings(State state, List keys) {
keys.collectMany { key ->
List<String> strings = Collections.emptyList()
def container = state.getHandleContainer(key) // returns HandleContainer<Object> not HandleContainer<SearchHandle>
if (container != null) {
def result = container.handle.result
if (result != null && result.itemCount > 0) {
strings = Arrays.asList(result.items)
}
}
strings
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)