Inherited methods with incompatible return types are allowed

Issue #87 resolved
Jesper Öqvist created an issue

Tested with JastAddJ 7.1.1-258-g867d218 Java SE 8

Test case:

// Incompatible return types in inherited methods
// .result=COMPILE_FAIL
interface I {
    int f();
}
class C {
    public String f() {
        return "x";
    }
}
abstract class Test extends C implements I {
}

Expected output:

Test.java:13: error: f() in C cannot implement f() in I
abstract class Test extends C implements I {
         ^
return type String is not compatible with int
1 error

Comments (2)

  1. Log in to comment