Thodoris Sotiropoulos created GROOVY-11493:
----------------------------------------------

             Summary: RuntimeError when implementing interfaces with 
conflicting default methods
                 Key: GROOVY-11493
                 URL: https://issues.apache.org/jira/browse/GROOVY-11493
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program
{code:java}
interface A {
  default void m() {
    System.out.println("here");
  }
}

interface B {
  default void m() {
    System.out.println("there")
  }
}

interface C extends B, A {}

class Test implements C {
  public void test() {
    this.m();
  }

  public static void main(String[] args) {
    Test x = new Test();
    x.test();
  }
} {code}
h3. Actual behavior

The code compiles, but there's a runtime error
{code:java}
Exception in thread "main" java.lang.AbstractMethodError: Receiver class Test 
does not define or inherit an implementation of the resolved method 'void m()' 
of interface B.
        at Test.test(groovy109.groovy:17)
        at Test.main(groovy109.groovy:22)
 {code}
h3. Expected behavior

The code should have been rejected



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to