We’re trying to move to SonarScanner based on JDK11 for a Java8 project.
We face multiple deprecation warnings about the code like this new Integer(...) Class.forName(...).newInstance();
The problem is that those methods are not deprecated in JDK1.8 (while they’re in JDK11).
How to correctly solve the issue?
Setting sonar.java.source explicitly = 1.8 didn’t help.
Sorry for the very long time you had to wait before getting an answer. This is, unfortunately, a known issue, on which we are currently (and finally) working. The JDK analyzed by the project being not the same one used during the analysis, and consequently reporting issues that are not fixable.
Hopefully, our next Java Analyzer release should allow us to be able to handle these cases correctly, and not report FPs of this kind anymore. You can track the ticket here: SONARJAVA-3056