Java exceptions for SonarLint on Eclipse (C project)

I am getting an error when I try to run SonarLint analysis in Eclipse for a C project. I have tried uninstalling, reinstalling and none of it works. Appreciate any help in fixing this.
error log.txt (33.2 KB)

Windows 10 v1803 (build 17134.523)
Eclipse Version: 4.7.3
SonarLint version: 4.0.0

When I run an analysis manually:
Error during execution of SonarLint analysis
java.lang.UnsupportedOperationException: Unsupported value of STDC_VERSION macro: 201710L
at com.sonar.cpp.N.H.A(na:3497)
at com.sonar.cpp.N.A.A(na:1763)
at com.sonar.cpp.plugin.R.A(na:2887)
at com.sonar.cpp.plugin.R.execute(na:156)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)

When eclipse starts:
Setting filesystem encoding: UTF-8
Error during execution of SonarLint analysis
java.lang.NullPointerException
at com.sonar.cpp.N.H.B(na:1388)
at com.sonar.cpp.N.A.A(na:400)
at com.sonar.cpp.plugin.R.A(na:2887)
at com.sonar.cpp.plugin.R.execute(na:156)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(SensorsExecutor.java:72)

Hi @sujeeth,

thank you for your report, we are aware of such issue, it is going to be fixed in the next version, we have an internal ticket for that: CPP-2066.

@sujeeth as the issue is probably due to the fact that you are using GCC 8 with c18 by default you may wanna set -std=c11 for the time being.

Hi @mpaladin , I set the compiler flag -std=c11 and still see the issue :slightly_frowning_face: with the same error messages as my original post. Today SonarLint updated to 4.1 as well and still seeing the issue.

@sujeeth we can’t blindly guess how exactly you specified -std=c11, but definitely wrongly.

For example here is default configuration in a fresh installation of Eclipse IDE for C/C++ Developers version 2018-12 (4.10.0), which indeed fails with GCC 8:

And here is example of configuration that works:

Hi @Godin , it is set in the same place as you mentioned. Please see attached.

Do you realize that your earlier statement

the same error messages as my original post

is actually wrong? :wink: Because original was

java.lang.UnsupportedOperationException: Unsupported value of STDC_VERSION macro: 201710L
    at com.sonar.cpp.N.H.A(na:3497)
    at com.sonar.cpp.N.A.A(na:1763)

and your screenshot shows

java.lang.NullPointerException
    at com.sonar.cpp.N.H.B(na:1388)
    at com.sonar.cpp.N.A.A(na:400)

@Godin, sorry about the confusion. My original description mentions both the error messages. I have been receiving one or the other. And with c11 it is consistently the NullPointer

Hi Team,

Can I get some help with the below error?

java.lang.NullPointerException
at com.sonar.cpp.N.H.B(na:1388)
at com.sonar.cpp.N.A.A(na:400)

Hi @sujeeth,

could you please do the following:

Hi @mpaladin,

Please find attached.
sonarlint console.txt (17.8 KB)

Hi @sujeeth,

thank you, I was able to reproduce the issue, I created a ticket on the dev side to fix it: CPP-2090

Thank you @mpaladin for the quick turn around on this issue.

@mpaladin I noticed the dev ticket is now marked resolved. But I assume the release is still a long way out. Is there a temporary workaround I can do to get past this issue and have my code analysed?

Thanks.

Hi @sujeeth,

the release happened, version 6.1 of the analyzer was released! You should update the plugin on your SonarQube server.

1 Like

Thank you @mpaladin. After updating the plugin, it seems to work now.

1 Like