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-6168) STC bug with generics
Date Sun, 26 Aug 2018 02:05:00 GMT

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

Paul King closed GROOVY-6168.
-----------------------------
    Resolution: Cannot Reproduce

This example and a few similar ones work now. Please reopen if you have other cases that are
still problematic.

> STC bug with generics
> ---------------------
>
>                 Key: GROOVY-6168
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6168
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static Type Checker
>    Affects Versions: 2.1.3
>            Reporter: Andrew Eisenberg
>            Priority: Major
>
> I've known about this bug for a while, I just haven't gotten around to raising the issue.
 Originally reported in GRECLIPSE-1546, I can reproduce on the command line with groovy 2.1.3.
> This Java Class:
> {code}
> package test;
> import groovy.lang.Closure;
> public class TestStaticJ
> {
> 	public <T> T doSomething(Closure<T> closure)
> 	{
> 		return closure.call();
> 	}
> }
> {code}
> and this groovy class:
> {code}
> package test
> import groovy.transform.CompileStatic;
> class TestStaticG {
> 	@CompileStatic
> 	List<String> test() {
> 		TestStaticJ t = new TestStaticJ()
> 		return t.doSomething {
> 		}
> 	}
> }
> {code}
> Compiler error, when it shouldn't:
> {code}
> Groovy:[Static type checking] - Cannot return value of type java.lang.Object on method
returning type 
>  java.util.List <String> -> java.util.List <E extends java.lang.Object>
> {code}



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

Mime
View raw message