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

Paul King updated GROOVY-9660:
------------------------------
    Description: 
*code example :*
{code}
trait Data {}

class TestData implements Data {}

class AbstractData<D extends Data>{ D data }

def test = new AbstractData<TestData>()
{code}
 

*when i compile groovy,it compile failed:*
{noformat}
1 compilation error:

The type TestData is not a valid substitute for the bounded parameter <D 
extends Data>
 at line: 7, column: 29
{noformat} 

Is this the wrong way to write it?

 

 

  was:
*code example :*

trait Data {}

class TestData implements Data {}

class AbstractData<D extends Data>\{ D data }

def test = new AbstractData<TestData>()

 

*when i compile groovy,it compile failed:*

{color:#ff0000}org.codehaus.groovy.control.MultipleCompilationErrorsException: 
startup failed:{color}
 {color:#ff0000}TestTrait.groovy: 11: The type TestData is not a valid 
substitute for the bounded parameter <D extends io.github.hdfg159.Data>{color}
 {color:#ff0000} @ line 11, column 29.{color}
 {color:#ff0000} def test = new AbstractData<TestData>(){color}

 

Is this the wrong way to write it?

 

 


> generic type class extend tarit
> -------------------------------
>
>                 Key: GROOVY-9660
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9660
>             Project: Groovy
>          Issue Type: Question
>          Components: Groovy Console
>    Affects Versions: 3.0.5
>         Environment: groovy 3.0.5 + jdk1.8
>            Reporter: zzy
>            Priority: Major
>              Labels: build
>
> *code example :*
> {code}
> trait Data {}
> class TestData implements Data {}
> class AbstractData<D extends Data>{ D data }
> def test = new AbstractData<TestData>()
> {code}
>  
> *when i compile groovy,it compile failed:*
> {noformat}
> 1 compilation error:
> The type TestData is not a valid substitute for the bounded parameter <D 
> extends Data>
>  at line: 7, column: 29
> {noformat} 
> Is this the wrong way to write it?
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to