False positive when overriding/implementing deprecated methods

When a class implements an interface all its methods must be implemented. However, when a method in the interface is marked @Deprecated(forRemoval = true) Sonar raises java:S5738(Don’t override this deprecated method, it has been marked for removal). This is nonsense because I am forced by Java to implement this interface method.

This rule must only fire for methods that already have an implementation in a super class.

Example:

interface A {
  @Deprecated(forRemoval = true)
  void foo();
}

class B implements A {
  @Override
  public void foo() { ... } // will raise java:S5738
}

Hi @sithmein,

Thanks for the report, it looks indeed like SQ is not setting you up to win in any sort of way with this issue. That sounds like a FP to me as well and I have created this ticket to tackle it.

Cheers,

Dorian