OLd issues are reported as new issues

  • Sonar version: 9.7.1 Developer edition
  • Java 17 project

Sometimes we get old issues reported as being new issues. The lase example comes from last night.
IN the java project, the new issues are defined based on the previous version.
The classes that were reported as having this problem has not been changed lately.
The 2 rules that are involved in the issues reported as ‘new’ are java:S2057 and java:S3437

We have migrated recently our DB. I don’t know if this has an impact.

  • Update. Today 2 old issues are again reported as new. They are related to java:S1699 and java:S6212

Hey there.

All of these rules are dependent on accurate semantics being available to the analyzer. See the documentation on Java analysis and bytecode.

So it sounds like maybe something changed with your build/dependencies in between runs. If you compare the build logs (including SonarQube analysis) from before and after, do you see any significant changes in the build or in messages produced by the scanner?

We upgraded the minor version of our jdk image used to build the project.
But nothing else changed.
I just checked again the issues that were reported today and I see that they were not reported before. So they are new issues because they were not reported. But in fact the files has not been changed recently.
I don’t have some other logical details that might help for this case…

I just had the same problem today: we switched to a new version and changed some code.
The PR scanner reported no problems. Afterwards we merged into the development branch and the nightly build reported 28 new problems. All on some code that wasn’t touched for months.
Can somebody explain me why?

It would be important for you to provide all the details, just as screenshots, scanner logs, and specific issues that were raised… we can’t just guess, unfortunately.

Let’s try to show you an example:
The class DelayRule was having one issue

After the change of the version and some other non related class DelayRule has now 3 issues:

If we check the history of the file in InteliJ we see the file was not changed since 08/2022

And in sonar, the information about the commit of the code that creates problem says that that part of the code was changed in 2018

No rules were changed/added between the 2 versions
Do you need more precise information about the project?