Consider the below example,
public class Testing extends SupCls implements Intf {
public static void main(String[] args) {
new Testing().test();
}
}
class SupCls {
public void test() {
System.out.println("From SupCls");
}
}
interface Intf {
public default void test() {
System.out.println("From Intf");
}
}
As you can see, there's no connection between SupCls
class and Intf
interface. But both are defining a common method.
And Testing
class is extending SupCls
and implementing Intf
.
So, when I call test()
method on Testing
the output is,
From SupCls
Which I think makes sense because extending from a class should take higher priority than implementing from an interface.
But eclipse reports otherwise, as shown in the below screen capture.
I strongly believe this is a bug in Eclipse.
But before assuming, is this behavior defined & documented in the JLS? Or is there something else which defines this behavior?
Edit: Eclipse version is Mars Release (4.5.0), if it matters.