Java exceptions for SonarLint on Eclipse (C project)

c
sonarcfamily

(Sujeeth Kolluru) #1

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)


NullPointerException During SonarLint Analysis in Eclipse (cfamily)
(Massimo Paladin) #3

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.


(Massimo Paladin) #5

@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.


(Sujeeth Kolluru) #6

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.


(Evgeny Mandrikov) #7

@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:


(Sujeeth Kolluru) #8

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


(Evgeny Mandrikov) #9

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)

(Sujeeth Kolluru) #10

@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


(Sujeeth Kolluru) #11

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)


(Massimo Paladin) #12

Hi @sujeeth,

could you please do the following:


(Sujeeth Kolluru) #13

Hi @mpaladin,

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


(Massimo Paladin) #14

Hi @sujeeth,

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


(Sujeeth Kolluru) #15

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