Sonar lint java analysis broken - Idea 2020.1/JDK11

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)

Sonar lint:

Intellij IDEA:
IntelliJ IDEA 2020.1 (Ultimate Edition)
Build #IU-201.6668.121, built on April 8, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 2000M
Cores: 4
Non-Bundled Plugins: Batch Scripts Support, CMD Support, com.alayouni.ansiHighlight, com.github.leomillon.uuidgenerator, CheckStyle-IDEA, com.ppolivka.gitlabprojects, com.intellij.jira, org.sonarlint.idea, com.intellij.ideolog, com.vermouthx.idea, ideanginx9, BashSupport, com.intellij.plugin.adernov.powershell, com.intellij.kubernetes, izhangzhihao.rainbow.brackets, org.jetbrains.plugins.ruby, com.jetbrains.php, org.asciidoctor.intellij.asciidoc

  • error observed (wrap logs/code around triple quote ``` for proper formatting)
Unable to create symbol table for : C:\Path\to\
	at org.objectweb.asm.ClassReader.<init>(
	at org.objectweb.asm.ClassReader.<init>(
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(
	at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.execute(
	at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(
	at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(
	at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$analyze$0(
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withReadLock(
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(
	at org.sonarlint.intellij.core.ConnectedSonarLintFacade.analyze(
	at org.sonarlint.intellij.core.SonarLintFacade.startAnalysis(
	at org.sonarlint.intellij.analysis.SonarLintAnalyzer.analyzeModule(
	at org.sonarlint.intellij.analysis.SonarLintTask.analyze(
	at org.sonarlint.intellij.analysis.SonarLintJobManager.lambda$runTask$1(
  • steps to reproduce

enable verbose output (gear icon top right of the tool window) then scan a Java source file (JS works fine for example in contrast to Java).
The Project is a maven project with Java 8 as target and as used JDK and it is bound to a sonarqube instance.

  • potential workaround

Run IJ on JDK-8 should work I have heared. I did not try that by myself.

Hello, thanks for reporting.

There are actually 3 possible workarounds, depending on your constraints:

  • run your IDE with Java 8
  • update the version of the Java analyzer on your SonarQube server
  • avoid connected mode when working on this project - standalone mode uses a newer version of the Java analyzer that’s compatible with Java 11

This is indeed a known limitation, due to a nasty interaction between SonarLint, the IntelliJ runtime, its underlying JRE, and our Java analyzer.

The issue is that the Java analyzer tries to resolve a class from the Java standard library, using the one it is running under; in this case, this will be the Java 11 runtime provided by IntelliJ. However, since this version of the Java analyzer is too old, it is not able to read those classes.

A more correct fix for this issue would be for SonarLint to read the SDK configured for the project and tell the Java analyzer which one to use. Unfortunately, there are a few technical hurdles that prevent us from doing so.