Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.9
-
Component/s: Java analysis
-
Labels:None
Description
Analyzing a Java file requires to provide its classpath to the Java analyzer (sonar.java.libraries). Since we are not passing rt.jar/jrt-fs.jar, the Java analyzer will fallback and use runtime JRE/JDK classes, which might not contains the same things.
I have created 2 sample projects to exhibit the problem:
- open the project in an IntelliJ having a Java 11 runtime
- assign a JDK 8 to the first module
- assign a JDK 13 to the second module
- enable rule java:S4551
In the first module (compiler with JDK 8), issue is not raised because the enum AWTUtilities.Translucency was removed in JDK 11, and because our Java analyzer is using the runtime JDK (11) it can't resolve the type.
In the second module (compiled with JDK 13), issue is not raised because the enum value Tree.Kind.SWITCH_EXPRESSION was introduced in JDK 12, and because our analyzer is using the runtime JDK (11) it can't resolve the type.
Attachments
Issue Links
- relates to
-
SONARJAVA-3056 Classes for the analysis are loaded with parent first strategy
-
- Closed
-