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

Paul King resolved GROOVY-8000.
-------------------------------
    Fix Version/s: 3.0.6
                   4.0.0-alpha-1
       Resolution: Fixed

Proposed PR merged. Thanks!

> Problem With Trait Generics
> ---------------------------
>
>                 Key: GROOVY-8000
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8000
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: Jeff Scott Brown
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.6
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The project at https://github.com/jeffbrown/generictraits contains the 
> following:
> {code:title=src/main/groovy/demo/TopTrait.groovy|borderStyle=solid}
> package demo
> trait TopTrait<T> {
>     T getSomething() {}
> }
> {code}
> {code:title=src/main/groovy/demo/MiddleTrait.groovy|borderStyle=solid}
> package demo
> trait MiddleTrait<T> implements TopTrait<T> {}
> {code}
> {code:title=src/main/groovy/demo/BottomTrait.groovy|borderStyle=solid}
> package demo
> trait BottomTrait<T> implements MiddleTrait<T> {}
> {code}
> {code:title=src/main/groovy/demo/Demo.groovy|borderStyle=solid}
> package demo
> // if this class implements MiddleTrait instead
> // of BottomTrait, it will compile...
> class Demo implements BottomTrait<String> {}
> {code}
> {noformat}
>  $ ./gradlew clean cG
> :clean
> :compileJava UP-TO-DATE
> :compileGroovy
> startup failed:
> /Users/jeff/t/generictraits/src/main/groovy/demo/Demo.groovy: -1: The return 
> type of java.lang.Object getSomething() in demo.Demo is incompatible with 
> java.lang.String in demo.TopTrait
> . At [-1:-1]  @ line -1, column -1.
> 1 error
> :compileGroovy FAILED
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':compileGroovy'.
> > Compilation failed; see the compiler error output for details.
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or 
> --debug option to get more log output.
> BUILD FAILED
> Total time: 2.123 secs
> {noformat}



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

Reply via email to