Exception in Sonar Maven Plugin: targetType is null

Must-share information (formatted with Markdown):

  • which versions are you using: last maven plugin version
  • how is SonarQube deployed: zip

Context:

We have this exception during the sonar maven scanner and the given file has not been parsed by the sonar maven plugin.

java.lang.NullPointerException: Cannot invoke “org.eclipse.jdt.internal.compiler.lookup.TypeBinding.getSingleAbstractMethod(org.eclipse.jdt.internal.compiler.lookup.Scope, boolean)” because “targetType” is null

at org.eclipse.jdt.internal.compiler.ast.LambdaExpression.internalIsCompatibleWith(LambdaExpression.java:906)

Problem Details

See the attachment for more information.
sonarqube_bug_1.zip (7.6 KB)

Expected Behavior

No exception is thrown and java class is parsed by plugin correctly.

Hey there!

I see meteoswiss in the logs. You are my weather application of choice. :slight_smile:

Would it be possible for you to share wpe-common/src/main/java/ch/meteoswiss/wpe/common/config/FuncApplication.java? This is probably the only way to know exactly why the parsing is failing.

Hi,

i’m happy to hear that your choice is our weather application :slight_smile:
The java class is already as attachment in the topic. Tell me if you need something more.

1 Like

I’m sorry I missed it! I’ll pass this info onto the right team.

Hi @antonio.ramos.MCH,

I need compilable Java source files to reproduce this issue and investigate more.
Can you please provide me with a minimal, complete reproducer - Java file with all dependencies included and effective pom.xml?

Thank you!

All the best,

Irina

Hi Irina,

Finally, after some time and some tweaking, I can deliver what you asked for.
I can reproduce the same bug again…

Hope it helps!
wpe-test-sonarqube.zip (26.8 KB)

Best Regards
Antonio

Hi @antonio.ramos.MCH,

I was able to reproduce your issue. It seems like a bug in ECJ, and I am investigating.

Suppose this is blocking your work and analysis. In that case, I suggest you extract either the first or second parameter of the method registerBean to the variable, which should be a temporary solution.

I will keep you updated on this topic.
Thanks a lot for reporting!

All the best,

Irina

1 Like

Hi @antonio.ramos.MCH,

We released a new version of Sonar Java: Release 8.5.0.37199 · SonarSource/sonar-java · GitHub, which should solve your problem.
Feel free to reply to this thread if the problem persists!

Just be aware that this analyzer version will be in the SonarQube 10.8 version.

All the best,

Irina