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 2020/06/25 02:56:00 UTC
[jira] [Resolved] (GROOVY-9606) Traits using generics generate
incorrect stub for Methods
[ https://issues.apache.org/jira/browse/GROOVY-9606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Sun resolved GROOVY-9606.
--------------------------------
Fix Version/s: 3.0.5
4.0.0-alpha-1
Assignee: Paul King
Resolution: Fixed
> Traits using generics generate incorrect stub for Methods
> ---------------------------------------------------------
>
> Key: GROOVY-9606
> URL: https://issues.apache.org/jira/browse/GROOVY-9606
> Project: Groovy
> Issue Type: Bug
> Components: Stub generator / Joint compiler
> Affects Versions: 2.5.6
> Reporter: Keegan Witt
> Assignee: Paul King
> Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.5
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> {code:groovy}
> trait SomeGroovyTrait<D> {
> List<D> list(D arg) {
> [arg]
> }
> }
> class SomeGroovyClass implements SomeGroovyTrait<String> { }
> {code}
> Generates a stub like this
> {code:groovy}
> ...
> public class SomeGroovyClass implements SomeGroovyTrait<java.lang.String>, groovy.lang.GroovyObject {
> ...
> public java.util.List<D> list(D arg) { return (java.util.List<D>)null;} // <== D should be String
> }
> {code}
> Note that the return type and parameter types use {{D}} instead of type {{String}} and the generic reference isn't declared in the class either.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)