Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Follow up from GROOVY-9033. Consider the following:
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 } }