[ https://issues.apache.org/jira/browse/GROOVY-11549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17910602#comment-17910602 ]
Paul King commented on GROOVY-11549: ------------------------------------ This does look like a bug. Since "I1" already extends "IO<String>" you can re-write your Groovy class as: {code:groovy} class B implements I1 { } {code} Which seems to work, though I agree your original should still work. > False positive "Can't have an abstract method in a non-abstract class." when > implement Java interfaces > ------------------------------------------------------------------------------------------------------ > > Key: GROOVY-11549 > URL: https://issues.apache.org/jira/browse/GROOVY-11549 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 5.0.0-alpha-11, 4.0.24 > Reporter: Xiaotian Ma > Priority: Major > > h1. Source code > The following code should be compiled, but actually not. > {code:java} > // Java Files > // FILE: I0.java > public interface I0<T> { > public T func(); > } > // FILE: I1.java > public interface I1 extends I0<String> { > @Override > default String func() { > return "I1"; > } > } > {code} > {code:groovy} > // Groovy File > // FILE: B.groovy > public class B implements I1, I0<String> { > } > {code} > h1. Error > {code:none} > B.groovy > Groovyc: Can't have an abstract method in a non-abstract class. The class 'B' > must be declared abstract or the method 'java.lang.Object func()' must be > implemented. > {code} > h1. Expected output > Compiler should pass this code. > h1. Other > Method "java.lang.Object func()" has already overridden in Java interface > "I1" with a type argument "String". If I remove the type parameter "T" in > "I0", like this: > {code:java} > // Java Files > // FILE: I0.java > public interface I0 { > public String func(); > } > // FILE: I1.java > public interface I1 extends I0 { > @Override > default String func() { > return "I1"; > } > } > {code} > the error disappear. As far as I know, Java compiler will generate a bridge > method "java.lang.Object func()" in "I1" in bytecode. So maybe the groovy > compiler misread the bridge method in "I1"? -- This message was sent by Atlassian Jira (v8.20.10#820010)