S7027 prevents from using sealed classes

Hello,
rule javaarchitecture:S7027 (Circular dependencies between classes in the same package should be resolved) triggers when it finds a sealed class and its implementation. This is not really a FP, but probably an unintended behavior.
I noticed this is SonarQube Server Developer Edition, v10.8.
SonarQube for IDE does not show this error, even when it is connected.

public abstract sealed class AbstractRule permits Rule
{
  // any code
}
public final class Rule extends AbstractRule
{
  // any code
}
1 Like

Hello @TunaIII , welcome to the community!

You are right that this is a false positive, or at least, unwanted behavior. The cycle detection rules (S7027 and S7091) should ignore cycles that appear because of permits, because they are inevitable and not a design problem.

I created a ticket for that issue here.

Best,

Marco

can you please share the link to the ticket. It is impossible to open the link without requiring authentication.

Hey @George_Monet

The ticket is private (it’s not always obvious even to us which ones are private and which ones aren’t, since it varies by Jira project).

I’ve linked this thread in the ticket so we can do our best to come back on this thread when a fix is on the way.

1 Like