On Sonarqube Enterprise Edition v2025.5 (113872), the issue java:S5738 is consistently raised on methods using formerly deprecated methods.
To be more accurate, we had generic classes (in package common.generic) that were marked as deprecated at some point due to some revision on our architecture, which used new generic classes (in package common.newgeneric), that were progressively rolled out on the application.
The old generic classes (in package common.generic) were marked with @Deprecated(forRemoval = true), which raised around 800 deprecated issues - those were expected.
The new generic classes (in package common.newgeneric) followed the same structure as the old classes, with identical names (just the package name differed). No issue was raised when initially using these classes.
The issue arose when we deleted the old generic classes (in package common.generic), and replaced them with the (non-deprecated) new generic classes (that were in package common.newgeneric). The process was done in a single MergeRequest:
- Delete
common.generic; - (Fix anything that still wrongly used any old generic class);
- Move everything from
common.newgenerictocommon.generic(i.e. rename the package);
Merging said MR caused all deprecated warnings to reappear, and new code that uses these generic classes also has the issue raised, despite having no @Deprecated annotation on the generic classes.
We are forced to constantly mark this class usage as False-Positive, but this is both time-consuming, and error-inducing. Is there any solution to make the Sonar analysis realise that these generic classes are, in fact, no longer deprecated, and that their usage should not raise any error?
Additionnal notes:
- The project is multi-module;
- The build is performed using maven on a fresh docker jdk container, the analysis is done used the maven plugin - JDK used is 21 in both cases