Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
Nested generics should be shown as well, see the TODO in the following code:
class Groovy8609Bug extends CompilableTestSupport { void testUpperBoundWithGenericsThroughWrongType2() { def errMsg = shouldFail ''' @groovy.transform.CompileStatic public class A<T extends List<E>, E extends Map<String, Integer>> { E getFirstRecord(T recordList) { return recordList.get(0) } static void main(args) { def list = new ArrayList<HashMap<String, Long>>() def record = new HashMap<String, Long>() list.add(record) def a = new A<ArrayList<HashMap<String, Integer>>, HashMap<String, Integer>>() assert record.is(a.getFirstRecord(list)) } } ''' // TODO we should print generics details, e.g. [Static type checking] - Cannot call A <ArrayList, HashMap<String, Integer>>#getFirstRecord(T) with arguments [java.util.ArrayList <HashMap<String, Long>>] assert errMsg.contains('[Static type checking] - Cannot call A <ArrayList, HashMap>#getFirstRecord(T) with arguments [java.util.ArrayList <HashMap>]') } }