Skip to content

Fix S2743 FP: static abstract interface members in generic interfaces #9822

Description

@gao-artur

Description

Consider this interface definition

public interface IExporter<in TParameters>
{
    Task ExecuteExport(TParameters queryParameters, CancellationToken token);
    static abstract string ExportFilePrefix { get; }
}

This appears to be a false positive. ExportFilePrefix is not a static field or static state stored on the generic interface. It is a static abstract interface contract that each implementing type must provide. No per-constructed-generic static storage exists on the interface itself.

Reproducer

public interface IExporter<in TParameters>
{
    Task ExecuteExport(TParameters queryParameters, CancellationToken token);
    static abstract string ExportFilePrefix { get; }
}

Product and Version

SonarQube Server v2026.2.1 (121354)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions