FP on deprecated constructor

On SonarQube 8.5 the following code produces java:S1874 Don’t override a deprecated method or explicitly mark it as “@Deprecated”:

package foobar;

public class Foo {

    /**
     * @deprecated
     */
    @Deprecated
    public Foo() {
    }

    public Foo(String s) {
    }
}

class Bar extends Foo {

    public Bar() {
        super("");
    }
}

In my opinion it is fine to override the deprecated constructor and not make it as @deprecated, because I am calling a non deprecated constructor via super(…).

Hi Tobias,

Thanks for your feedback. It really a FP, so created a ticket to fix this issue.

Feel free to go through it and check whether it makes sense to you.

Kind regards,
Margarita

Looks good. Thank You!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.