IllegalArgumentException with IntersectionTypeConstructor

I am implementing Sonar to connect to SonarCloud for the first time on my kotlin project. I have set Sonarqube at 3.5.0.2730, using Cover 0.6.1. The build server (Gitlab) was already configured to pick up Sonar configurations (IE it’s already running the sonar gradle task if configured for the project), so I was just plugging it in to my build.gradle file.

The task runs fine. Sonar is running, and reports successful, but in the log is the following caveat.

> Task :sonar
Cannot analyse 'src/main/kotlin/md/quin/process/flow/common/flow/fhir/FhirStepConverter.kt' with 'KtChecksVisitor': declarationDescriptor is null for constructor = {String & Type} with class org.jetbrains.kotlin.types.IntersectionTypeConstructor
java.lang.IllegalArgumentException: declarationDescriptor is null for constructor = {String & Type} with class org.jetbrains.kotlin.types.IntersectionTypeConstructor

along with a very long stack trace.

Now FhirStepConverter.kt is a file with no classes in it, only functions, and I am wondering whether that’s why. The file is under test, so I am certainly expecting/hoping for Sonar results, it just has no class (and therefore no constructors).

Kover does report results on the file (99% line coverage), so it is getting analyzed, I am not sure what Sonar is asking for, if the Kover results are there.

1 Like

Hi,

Welcome to the community!

Before we get into the specifics of your question, I need to nail down some fundamentals.

First, are you trying to use SonarQube or SonarCloud? And if the former, what version? (You’ll find it in the SonarQube page footer).

 
Ann

Hello,

I’m having the same problem in 3 files as well, using Community Edition, v10.7 on server and Sonar Gradle Plugin version 6.0.1.5171.

Any suggestions?

Thanks in advance.

Hi @BerkayMutlu,

Welcome to the community!

Can you upgrade to the latest version, currently 25.3, and see if this is still replicable?

 
Thx,
Ann

1 Like

We’ve upgraded the server to Community Build v24.12, but the issue persists. I’m not sure if this is related with server version. Although I’m not familiar with the inner workings of Sonar, I was thinking it could be a bug in the Sonar’s Gradle Plugin instead.

We’ll try upgrading server to 2025.3 and see if it helps. Any suggestion is appreciated in the meantime :folded_hands:

Thank you,
Mustafa.

Unfortunately 2025.3 didn’t fix either.

I excluded these files from the scan (there were only 3 in my project), which made the sonar task succeed but there is no project created on the website. We’re investigating on why.

Hi,

Thanks for trying the upgrade.

Can you re-include those files and give us a --info analysis log (I assume you’re building with Gradle)?

 
Thx,
Ann

Hello,

Yes I’m trying to use the Sonar Gradle Plugin. We found that it created a project using the project title (which is different than the projectKey we set) so it’s all good.

Excluding the files seemed to work. Analysis succeeds now.
I’ll try to send your the relevant logs but running sonar locally takes 1 hour and running on our CI takes 30 mins but because the logs are too long our CI stops recording them.

Also Jacoco code coverage import doesn’t work :smiley: I need to focus on this part first, before fixing the ignored files.

Thank you for your help :folded_hands:
Have a nice day.

1 Like