Maven Sonar Scanner not working with JDK 16

Dears,

I’m running sonar maven scanner using Jenkins declarative pipeline.
I have the following tools:

  • SonarQube 8.4.1
  • SonarQube maven scanner 3.8.0.2131
  • Java: OpenJdk 16

Maven build fails and I get the following error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project XXX: Unable to load component class org.sonar.plugins.javascript.JavaScriptSensor: ExceptionInInitializerError: java.lang.reflect.InaccessibleObjectException–>Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not “opens java.lang” to unnamed module @29ad3ac5 → [Help 1]

Do you have any idea on haw to resolve this issue.

Thank you in advance.
Best Regards.

Hi,

We simply don’t support analyzing with JDK 16 yet. As noted in the docs, we support Java 11 for analysis.

 
Ann

Well, this means i cannot run my IDE with SonarLint with Java 16 since lint plugin uses Sonar internally :\

HI @Endeavour,

Welcome to the community!

In fact, I wouldn’t be so sure about that. It’s probably worth creating a new topic in the SonarLint category to verify.

 
Ann

Hi @ganncamp

That you very much for your feedback.

Best Regards.
Wael

Thats not precisely what the docs say though…

SonarQube is able to analyze any kind of Java source files regardless of the version of Java they comply to.

HI @markw,

Welcome to the community!

If we’re going to get precise… :slightly_smiling_face:

In fact there is a distinction between

  • the JDK version you can run analysis with
  • the language spec version you can run analysis on

Ehm… well maybe to some degree. If you’ve had success analyzing code written to Java 16, then that’s great but there is a possibility that parsing may choke (and therefore analysis fail for the file) on features introduced in later language versions.

And SonarQube 9.1 will introduce real support of Java 16.

 
HTH
Ann