Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix S3444 FN: Support static methods in interfaces #6386

Closed
cristian-ambrosini-sonarsource opened this issue Nov 21, 2022 · 1 comment · Fixed by #6409
Closed

Fix S3444 FN: Support static methods in interfaces #6386

cristian-ambrosini-sonarsource opened this issue Nov 21, 2022 · 1 comment · Fixed by #6409
Assignees
Labels
Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@cristian-ambrosini-sonarsource
Copy link
Contributor

Description

FN for S3444 (InheritedCollidingInterfaceMembers).

Using C#11 static abstract/virtual methods in interfaces, the rule is not raising an issue.

Repro steps

    public interface IAbstractMethodFirst
    {
        public static abstract string StaticAbstractMethod(string value);
    }

    public interface IAbstractMethodSecond
    {
        public static abstract string StaticAbstractMethod(string value);
    }

    public interface IAbstractMethodCommon : IAbstractMethodFirst, IAbstractMethodSecond { } // FN

    public interface IVirtualMethodFirst
    {
        public static virtual string StaticVirtualMethod(string value) => value;
    }

    public interface IVirtualMethodSecond
    {
        public static virtual string StaticVirtualMethod(string value) => value;
    }

    public interface IVirtualMethodCommon : IVirtualMethodFirst, IVirtualMethodSecond { } // FN

Expected behavior

The rule should raise an issue.

Actual behavior

The rule does not raise an issue.

@gregory-paidis-sonarsource
Copy link
Contributor

We decided to not only support static abstract/virtual methods, but static methods in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants