groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (GROOVY-8609) Fails to compile when upper bound has generics
Date Thu, 26 Jul 2018 04:39:10 GMT

     [ https://issues.apache.org/jira/browse/GROOVY-8609?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Paul King closed GROOVY-8609.
-----------------------------

> Fails to compile when upper bound has generics
> ----------------------------------------------
>
>                 Key: GROOVY-8609
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8609
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.6.0-alpha-3, 3.0.0-alpha-2, 2.5.0
>            Reporter: Daniel Sun
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.1
>
>
> Fails to compile the following code:
> {code:java}
> @groovy.transform.CompileStatic
> public class A<T extends List<E>, E extends Map<String, Integer>> {
>     E getFirstRecord(T recordList) {
>         return recordList.get(0);
>     }
> }
> {code}
> *Error messages:*
> {code:java}
> BUG! exception in phase 'instruction selection' in source unit 'ConsoleScript0' Expected
earlier checking to detect generics parameter arity mismatch
> Expected: java.util.Map<K,V> 
> Supplied: java.util.Map<E> 
> 	at org.codehaus.groovy.ast.tools.GenericsUtils.extractPlaceholders(GenericsUtils.java:169)
> 	at org.codehaus.groovy.ast.tools.GenericsUtils.extractPlaceholders(GenericsUtils.java:142)
> 	at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.compareGenericsWithBound(GenericsType.java:375)
> 	at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.checkGenerics(GenericsType.java:307)
> 	at org.codehaus.groovy.ast.GenericsType$GenericsTypeMatcher.matches(GenericsType.java:276)
> 	at org.codehaus.groovy.ast.GenericsType.isCompatibleWith(GenericsType.java:198)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkTypeGenerics(StaticTypeCheckingVisitor.java:1174)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.checkReturnType(StaticTypeCheckingVisitor.java:2076)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor$1.returnStatementAdded(StaticTypeCheckingVisitor.java:309)
> 	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitReturnStatement(StaticTypeCheckingVisitor.java:2026)
> 	at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:49)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message