Hello Team,
We are observing a Kotlin analyzer exception during SonarQube analysis after upgrading to Kotlin 2.3.10.
Error:
ERROR: The diagnostic collector has been interrupted by an exception. The result may be incomplete
java.lang.IllegalArgumentException: source must not be null
Frequency:
Intermittent but reproducible with a minimal example
Environment:
- SonarQube Server: 2025.2
- Sonar Gradle plugin: 7.2.3.7755
- Kotlin: 2.3.10
- Gradle: 9.3.1
- JDK: 21 (Temurin)
- OS: macOS (arm64)
Reproduction Command:
./gradlew sonar \
--console=plain \
--info \
-Dsonar.host.url=<SONAR_HOST_URL> \
-Dsonar.token=<SONAR_TOKEN> \
-Dsonar.inclusions='src/main/kotlin/repro/SonarKotlinRepro.kt'
Key Stacktrace:
org.sonarsource.kotlin.checks.UselessAssignmentsCheck.visitKtFile
org.jetbrains.kotlin.fir.analysis.checkers.expression.FirIncompatibleClassExpressionChecker
Minimal Reproducer:
package repro
interface SonarKotlinRepro {
fun first(): String?
fun second(): String?
fun third(): Boolean
fun fourth()
}
Observed Behavior:
- Exception occurs during analysis
- Analysis still completes successfully
- No visible impact on coverage or final metrics
Suspected Cause:
Kotlin FIR (K2) incompatibility with Sonar rule UselessAssignmentsCheck.
Questions:
- Is Kotlin 2.3 officially supported?
- Is this a known issue?
- Are there any recommended workarounds?
Thanks.