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

Is there already some news to share about this issue?

We are currently in the process of upgrading to SonarQube 2025.1 LTA. I think I will downgrade the severity of this rule to not affect our scans too much until this is solved.

We normally stick at the LTA to have a stable environment for our teams. Is it planned to backport this fix to 2025.1 LTA when it is released?

Thanks,
Daniel

Hi @furti,

The issue is still not resolved, even in the latest version (2025.3).

However, there is some positive news: in SonarQube 2025.1, you can now disable individual rules without breaking inheritance from parent quality profiles. So it should be easier to disable individual rules (not just change severity) in Quality Profiles.

@Colin Thanks a lot for the information. In this case I will stick with downgrading the severity. So it has little impact on our teams but they are still able to see what issues they will have in the future and can start solving them.

Blockquote …in SonarQube 2025.1, you can now disable individual rules without breaking inheritance from parent quality profiles.

Awesome to hear that. I need this feature for another rule. Maybe to add a bit to your statement, there is a global setting you need to enable first sonar.qualityProfiles.allowDisableInheritedRules. At least when you upgraded your instance from an older version (e.g. 9.9 LTS) it is set to false by default.

1 Like