[ https://issues.apache.org/jira/browse/GROOVY-11549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11549. ---------------------------------- Fix Version/s: 5.0.0-alpha-13 Resolution: Fixed https://github.com/apache/groovy/commit/6a3d9424a479c3d684dc2d70f83162d3d88a3cf0 https://github.com/apache/groovy/commit/e484ac5a3e85b25bb64247b84f56a047606cc54b https://github.com/apache/groovy/commit/5b48d7d28c425a1b18877fd992316a6e3577f2d6 > 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 > Assignee: Eric Milles > Priority: Minor > Fix For: 5.0.0-alpha-13 > > > h1. Scenario > A.java > {code:java} > public interface A<T> { > public T func(); > } > {code} > B.java > {code:java} > public interface B extends A<String> { > @Override > default String func() { > return "I1"; > } > } > {code} > C.groovy > {code:groovy} > public class C implements A<String>, B { > } > {code} > h1. Outcome > {code:none} > C.groovy > Groovyc: Can't have an abstract method in a non-abstract class. The class 'C' > must be declared abstract or the method 'java.lang.Object func()' must be > implemented. > {code} > h1. Expected > Compiler should pass this code. > h1. Other > Method "java.lang.Object func()" has already overridden in Java interface "B" > with a type argument "String". If I remove the type parameter "T" in "A", > like this: > {code:java} > public interface A { > public String func(); > } > {code} > {code:java} > public interface B extends A { > @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 B’s bytecode. So maybe the groovy > compiler misread the bridge method? -- This message was sent by Atlassian Jira (v8.20.10#820010)