[
https://issues.apache.org/jira/browse/GROOVY-11549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-11549.
------------------------------
> 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-beta-1
>
>
> 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)