Gradle Plugin fails to scan on kotlin ..< operator: 'Cannot convert file due to syntactic errors'

Sonarqube plugin: 4.4.1.3373
Sonarqube deployed as a docker container on a remote host
Trying to analyze our project using the gradle plugin using gradle sonar command

We get the following error:

> Task :sonar
Unable to parse file: file:///Users/<snip>/service/BatchCardConverterService.kt. Parse error at position 91:47
Cannot parse 'src/main/kotlin/<snip>/BatchCardConverterService.kt': Cannot convert file due to syntactic errors

The error points to the ..< operator. We can resolve the problem by replacing it with the rangeUntil call, but we would rather keep using the operator

We have tried setting the sonar.kotlin.source.version=1.9 property, but that did not change the problem

1 Like

Hey @Floris_Thijssen,

Could you please clarify which version of SQ you’re using or are you using SonarCloud?

Best,
Margarita

We are using SQ Version 9.9.3 (build 79811)

Thanks for the answer. I think the point is that the analyzer shipped in that version doesn’t support Kotlin 1.9 (As it was released at the same time when we already had a code freeze before the LTS) If you want to get the latest versions of languages faster you should consider switching to the latest releases instead of LTS or using SonarCloud. The latest SQ 10.3 and SonarCloud support Kotlin 1.9.

Best,
Margarita

Hi Margarita,

I’ve recently come across a similar situation and I was wondering if there is a compatibility chart somewhere that lists SonarQube version vs Language version compatibility?

So far I haven’t found it but there might be a way to find out?
Thank you!

As far as I know, there’s no such table, so you need to read the release notes and check the plugin version in your SQ.

However, I will share that there’s a need and we’ll see what we can do.

Best,
Margarita