[
https://issues.apache.org/jira/browse/GROOVY-9606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King updated GROOVY-9606:
------------------------------
Description:
{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.
was:
{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 {{value}} has type {{V}} instead of type {{String}} and the generic
reference isn't declared in the class either.
> 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: Daniel Sun
> Priority: Major
> Fix For: 3.0.0-rc-1
>
>
> {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)