Hello Lrozenblyum,
The reason why the analyzer behaves differently in Java is because by default, it takes the JAVA API classes from the Java Runtime Environment where the analyzer is running in, not that of the JDK the project is build for. So in your case Java 11, where the Integer(int)
constructor was not yet deprecated.
Cross JDK analysis is possible by setting the jdkHome
parameter, but it’s meant for the other way around, e.g., to analyze a JDK 11 project inside a JDK 17 build environment. This is described in more detail in the documentation here.
Are there any specific reasons why you don’t want to upgrade your build environment to Java 17? We soon will drop scanner support for Java 11 anyway, and as @Colin pointed out, it’s more convenient to use the same JVM.
BR,
Marco