Why could this construct generate an error/warning in Eclipse? I understand for what it will generate a report, but I guess there must be some rationale, what can go wrong, if you spell out those redundant super interfaces.
Example:
interface I1{
void boo();
}
class A implements I1 {
public void boo() {}
}
class B extends A implements I1 {
public void boo() {}
}
The warning is in B, near implements I1 .
Imaging if class A
implement I1
and class B
extends A
. By default B
implements I1
even though it does not need to implement any method in I1
. If A
were to change to implement I2
, B
would still compile.
However, if B
explicitly implements I1
but does not provide the methods, then this change would cause B
to no longer compile.
Of course, I am ignoring the issues of users of B
that might be assuming that B
implements I1
. Let's assume for this case that that is not an issue.
It's only a warning, and I guess it has two reasons:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.