I would like to analyze part of my project with “sonar.java.source=1.4” (Legacy code on hardware).
The problem is that some issues are systematically raised even though they are not issues in 1.4.
In the example below, issues java:S2129 and java:S1874 are systematically raised.
I’m running “mvn test sonar:sonar -Dsonar.java.source=1.4”
The class:
public class Essai {
public void test()
{
Integer toto = new Integer(10);
Logger.getLogger("toto").log(Level.INFO,toto.toString());
}
}
pom.xml contains only:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
</build>
Note: I would like to keep the S2129 and S1874 rules, except for certain methods that are not really deprecated and are often used (like new Integer(int)).