Hi all,
I got the same exception as Florian posted before on a Maven project:
- sonar.java.source: 1.8
- maven.compiler.source: 1.8
- maven.compiler.target: 1.8
java.lang.IllegalArgumentException: Unsupported class file major version 55
To make sure, that the code is compiled for Java 8 I inspected the Maven target directory:
$ javap -verbose MyClass.class | grep "major"
major version: 52
Environment
- JDK: 8.0.222
- IDE
- Build version: IntelliJ IDEA 2019.2.2 Build #IU-192.6603.28 September 6, 2019
- Java version: 11.0.3+12-b304.56x86_64
- Operating System: Mac OS X (10.14.6, x86_64)
- JVM version: OpenJDK 64-Bit Server VM JetBrains s.r.o
- SonarLint (4.1.1.3345)
Now I changed the IntelliJ IDEA’s Java runtime to JDK 8 (https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under)
- Build version: IntelliJ IDEA 2019.2.2 Build #IU-192.6603.28 September 6, 2019
- Java version: 1.8.0_161-b12x86_64
- Operating System: Mac OS X (10.14.6, x86_64)
- JVM version: Java HotSpot™ 64-Bit Server VM Oracle Corporation
Result: Sonarlint works as expected. No exception.
It looks like the Sonarlint plugin uses JDK from IntelliJ instead of choosing the JDK according to the project settings (sonar.java.source).