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:51:00 UTC
[jira] [Resolved] (GROOVY-10051) STC: return type for unresolved
placeholder with bound resolved to Object
[ https://issues.apache.org/jira/browse/GROOVY-10051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-10051.
----------------------------------
Fix Version/s: 4.0.0-beta-1
Resolution: Fixed
> 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
> Priority: Major
> Fix For: 4.0.0-beta-1
>
>
> 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<Handle>
> 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)