Thodoris Sotiropoulos created GROOVY-11256:
----------------------------------------------

             Summary: Fail to identify direct call of abstract method
                 Key: GROOVY-11256
                 URL: https://issues.apache.org/jira/browse/GROOVY-11256
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following ill-typed program

{code}
interface A {
    int m();
}

class C implements A {
    public int m()  { return 1; }
    void test() {
        A.super.m();
    }
}

public class Test {
    public static void main(String[] args) {
        new C().test();
    }
}
{code}

h3. Actual behavior

The program compiles with and produces:

{code}
Exception in thread "main" java.lang.AbstractMethodError: 'int A.m()'
        at C.test(Test.groovy:8)
        at Test.main(Test.groovy:14)
{code}

h3. Expected behavior

Reject the program with:

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Test.groovy: 8: [Static type checking] - Abstract method m() cannot be called 
directly
 @ line 8, column 9.
           A.super.m();
           ^

1 error
{code}



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

Reply via email to