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

Eric Milles resolved GROOVY-9259.
---------------------------------
    Fix Version/s: 5.0.0-alpha-1
       Resolution: Fixed

https://github.com/apache/groovy/commit/df346d56deaec8b3d50d63eb71d2afc98454a463

> Implementing Groovy interface with default methods can cause compile issues.
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-9259
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9259
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.0-beta-3
>            Reporter: covers1624
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 5.0.0-alpha-1
>
>
> Hello!
> Consider the following classes.
> {code:java|title=test/JavaInterface.java|borderStyle=solid}
> package test;
> public interface JavaInterface {
>     String doStuff();
> }
> {code}
> {code:java|title=test/GroovyInterface.groovy|borderStyle=solid}
> package test
> interface GroovyInterface extends JavaInterface {
>     default doOtherStuff() {
>         return 'doot'
>     }
> }
> {code}
> {code:java|title=test/GroovyClass.groovy|borderStyle=solid}
> package test
> class GroovyClass implements GroovyInterface {
>     @Override
>     String doStuff() {
>         return "otherDoot"
>     }
> }
> {code}
> This code compiles with an error:
> {noformat}
> test/GroovyClass.groovy: 4: Method 'doStuff' from class 'test.GroovyClass' 
> does not override method from its superclass or interfaces but is annotated 
> with @Override.
>  @ line 4, column 5.
>        @Override
>        ^
> {noformat}
> However, removing the default method insideĀ ~GroovyInterface~, OR, declaring 
> ~GroovyClass~ to implement both ~GroovyInterface~ AND ~JavaInterface~ will 
> make compilation succeed again.
> Apologies if this is some form of intended behavior, although I suspect it 
> isn't due to the nature of this issue.
> Thank You for your time looking into this issue! also thanks for a 
> fantastically flexible language!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to