False Positive w/ javaarchitecture:S7027 when using sealed interfaces

rule javaarchitecture:S7027 is detecting false circular dependencies with sealed interfaces and their concrete implementations

reproduction:

  • create a sealed interface
  • create multiple concrete implementations (java records in our case) in the same package, but not as inner classes

Hi,

Could you provide your SonarQube Server version and a minimal reproducer?

 
Thx,
Ann

v2025.1

public sealed interface Foo permits Bar, Baz {
    //
}

public record Bar() implements Foo {
    //
}


public record Baz() implements Foo {
    //
}

All in separate .java files.

1 Like

Hi,

Thanks! I’ve flagged this for the experts.

 
Ann

Hi @efenderbosch ,

Thanks for reporting! This is an already known issue, see also this thread.

The issue will be fixed in one of our future releases.