You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/28 10:35:00 UTC
[jira] [Created] (GROOVY-8611) Refine the generics presentation
Daniel Sun created GROOVY-8611:
----------------------------------
Summary: Refine the generics presentation
Key: GROOVY-8611
URL: https://issues.apache.org/jira/browse/GROOVY-8611
Project: Groovy
Issue Type: Improvement
Reporter: Daniel Sun
Nested generics should be shown as well, see the TODO in the following code:
{code:java}
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>]')
}
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)