Question about Code Coverage related to Java11 to Java17 migration

If a project scanned using Java 11, why the Code Coverage updated as ‘0’ rather ‘Not Scanned’?. It gives a false impression(after paying to the tool license) and seeing overall code health by looking at zero. Eventually I have plans to upgrade to Java 17 but this coverage metrics has to reflect ‘Not Scanned’ or ‘NA’ until right version used. Otherwise the current Code Coverage on Sonar Dashboard is a clear mislead to leadership. Happy to get challenged on this.

Note: While upgrading from Java 11 to 17, what is stopping to produce code coverage in Java 11-Is it simply to push migration towards 17? In that case, why not facilitating alert while displaying right code coverage on Java 11?

Hello,

I’m sorry but I don’t see the link between the fact that we no longer support Java11 as a runtime env to scan your code and the fact that code coverage is ‘0’.

While upgrading from Java 11 to 17, what is stopping to produce code coverage in Java 11

You should continue to build and generate your code coverage results using Java11 until your project is ready to move to Java17.

What you should do is:

  • build and generate the coverage using Java11
  • scan with Sonar using Java17

It’s not at all mandatory to migrate your project to Java17 to continue using Sonar. We still have customers who build with Java8. It’s only the scan phase that must run now in a Java17 context.

I hope it’s clearer now.

Alex