However, I’m seeing the following when running mvn sonar:sonar [ERROR] Unable to parse source file : 'src/main/java/com/xyz/AbstractBaseModel.java' [ERROR] Parse error at line 71 column 21: Switch Expressions are supported from Java 14 onwards only
The most recent version of the sonar scanner, as noted above, was released in Oct 2019 while Java 14 was released in Mar 2020.
So, what exactly does it mean that Java 14 is supported in SonarQube when the scanner is not receiving the necessary updates to provide that support?
Are you passing a sonar.java.source value that’s lower than 14 to analysis? Either explicitly or perhaps implicitly by targeting compilation to a lower version?
Thanks. I added <sonar.java.source>14</sonar.java.source> to my pom properties and the error I reported above is gone. Thank you.
I’m now having a similar problem with the checkstyle sensor complaining about the new switch statement syntax: Can not execute Checkstyle: Exception was thrown while processing ...\AbstractBaseModel.java:IllegalStateException occurred while parsing file AbstractBaseModel.java:71:13: unexpected token: result ->