58 lines
1.0 KiB
Plaintext
58 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
All classes extend ``++Object++`` implicitly. Doing so explicitly is redundant.
|
|
|
|
|
|
Further, declaring the implementation of an interface _and_ one if its parents is also redundant. If you implement the interface, you also implicitly implement its parents and there's no need to do so explicitly.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,java]
|
|
----
|
|
public interface MyFace {
|
|
// ...
|
|
}
|
|
|
|
public interface MyOtherFace extends MyFace {
|
|
// ...
|
|
}
|
|
|
|
public class Foo
|
|
extends Object // Noncompliant
|
|
implements MyFace, MyOtherFace { // Noncompliant
|
|
//...
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,java]
|
|
----
|
|
public interface MyFace {
|
|
// ...
|
|
}
|
|
|
|
public interface MyOtherFace extends MyFace {
|
|
// ...
|
|
}
|
|
|
|
public class Foo implements MyOtherFace {
|
|
//...
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|