SonarJava analysis hangs

Template for a good bug report, formatted with Markdown:

  • SonarQube 7.9.1, SonarQube 8.0
  • mvn sonar:sonar hangs
$ mvn sonar:sonar
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------------< com.mycompany.app:my-app2 >----------------------
[INFO] Building my-app2 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ my-app2 ---
[INFO] User cache: /home/harperjon/.sonar/cache
[INFO] SonarQube version: 7.9.1
[INFO] Default locale: "fr_FR", source code encoding: "UTF-8"
[WARNING] SonarScanner will require Java 11+ to run starting in SonarQube 8.x
[INFO] Load global settings
[INFO] Load global settings (done) | time=76ms
[INFO] Server id: BF41A1F2-AW0A269MDCcIWLXZ_49c
[INFO] User cache: /home/harperjon/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=51ms
[INFO] Load/download plugins (done) | time=77ms
[INFO] Process project properties
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=3ms
[INFO] Project key: com.mycompany.app:my-app2
[INFO] Base dir: /tmp/my-app2
[INFO] Working dir: /tmp/my-app2/target/sonar
[INFO] Load project settings for component key: 'com.mycompany.app:my-app2'
[INFO] Load project settings for component key: 'com.mycompany.app:my-app2' (done) | time=14ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=52ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=2700ms
[WARNING] SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 3 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] Quality profile for xml: Sonar way
[INFO] ------------- Run sensors on module my-app2
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=56ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 8
[INFO] JavaClasspath initialization
[WARNING] Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.
[INFO] JavaClasspath initialization (done) | time=10ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=0ms
[INFO] Java Main Files AST scan
[INFO] 1 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=15ms
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java
[INFO] 0/1 files analyzed, current file: src/main/java/com/mycompany/app/Bar.java

  • steps to reproduce: execute sonar on the following source file:
import java.util.*;
import java.util.stream.*;

public class Bar<N, D extends N> {
    public void bar(List<D> foo) {
        Object x = foo.stream().map(y -> null);
    }
}
  • potential workaround: don’t use lambdas and stream, use a for loop.

Hi @jonenst,

big work is being done on the Java analyzer, I am not going to try to reproduce your issue on the current released version, this is surely going to work on version 6.0 of the Java analyzer which is going to be released soon. Just be patient a bit more and subscribe to the Announcements page. :pray: