Support for Kotlin/Native

Hello folks,

I know SonarQube supports Kotlin, but does it support Kotlin/Native? Compiler for Kotlin/Native generates platform native byte code rather than JVM byte code.

I’ve tried importing my sample project to SonarCloud, it doesn’t detect any source code (I’ve set up inclusion filters to “*.kt, *.kts” and chose “Kotlin” as language).

Is there anything I’m missing?
Any clues would be welcome.

Thanks!

As has been suggested, I’m using property("sonar.sources", "./src/commonMain/kotlin,./src/nativeMain/kotlin"), but getting this exception:

Execution failed for task ':sonar'.
> class java.lang.String cannot be cast to class java.util.Collection (java.lang.String and java.util.Collection are in module java.base of loader 'bootstrap')

Any help would be appreciated.

It’s great news there is support for Kotlin Multiplatform.

On top of that, does SonarQube support Kotlin / Native?
(I’ve tried importing my Kotlin/Native project and it can’t find any source code lines in it.)

Hi,

Welcome to the community!

You resurrected some tangentially related threads as well as starting this one. Per the FAQ, when a thread has been dormant for 2 months or more - as one of the two was - you should let it lie and start a new one. I’ve consolidated all your posts here.

 
Ann

Hello, @NorseDreki.

Regarding the exception:

Execution failed for task ':sonar'.
class java.lang.String cannot be cast to class java.util.Collection (java.lang.String and java.util.Collection are in module java.base of loader 'bootstrap')

It has been fixed by SCANGRADLE-133, and it is available in the Scanner for Gradle version 5.0.0.4637.

To help you the best, could you share your analysis configuration and the command you run to trigger the analysis?

The Kotlin analyzer relies on the Jetbrains Kotlin Compiler libraries, so the AST and the Semantics are provided to us.

Cheers,
Angelo

2 Likes

Hello @angelo.buono , thanks for heads up.

Bumping the Scanner to the version you’ve mentioned does fix the issue.

Thank you for your time.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.