Trailing comma on Kotlin 1.4

Versions Used

  • Sonarqube Community Edition Version 8.9 (build 43852)
  • Kotlin 1.4.31
  • IntelliJ 2021.1.1
  • SonarLint Plugin

What’s wrong

When trailing comma exists at the end of scope, sonarlint show parsing error.
This seems to be resolved from sonarqube 3.6 but still reproduced after upgrading to 3.9 commnunity edition.

Sample Code

When I inspect code like below…

class MyComponent(
    circuitBreaker: CircuitBreaker,
    webClient: WebClient,  // this line's comma
) {
    // ....

Error message appears like this.

Unable to parse file: file://MyComponent.kt. Parse error at position 32:55
Cannot convert file due to syntactic errors
Initializing metadata of file file:///MyComponent.kt

Am I missing something wrong?

Hello @themuser,

Welcome to the community!
Could you please show the full logs of the analysis and double-check which versions, you’re using. Kotlin 1.4 is properly supported since plugin version 1.8 and the parse error should not appear anymore.

If you’re using the connected mode, please, make sure you’re using the latest version of SQ, which is now 8.9, and check whether your bindings are outdated. If so, just press the ‘update bindings’ button and run the analysis again.

Feel free to get back to us if your problem is solved or you have further questions.


1 Like

I made a horrible mistake and yes, you’re right.
The problem is that I’ve never renewed bindings between sonarlint plugin and sonarqube server after upgrading sonarqube.
After clicking UPDATE BINDING, everhing works like a charm!

Thank you so much for your feedback.

1 Like

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