Scan on java with feature preview

I created a maven application running on java 13. In my code, I use some feature preview like switch or multi-line string.

So I use in my pom.xml:

					<argLine>@{argLine} --enable-preview</argLine>

Last december, I was able to run sonar without any issue.

mvn package
mvn sonar:sonar ....

Since january, I got this error:

[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version ( 13
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=11ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=2ms
[INFO] Java Main Files AST scan
[INFO] 159 source files to be analyzed
[INFO] 159/159 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=19509ms
[INFO] Java Test Files AST scan
[INFO] 31 source files to be analyzed
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:29 min
[INFO] Finished at: 2020-01-20T11:31:34Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project xxxxxx: SonarQube is unable to analyze file : 'src/test/java/com/xxxxxxx/part/': Unable to create symbol reference on file src/test/java/com/xxxxxx/part/ 57 is not a valid line offset for pointer. File src/test/java/com/xxxxxx/part/ has 27 character(s) at line 19 -> [Help 1]

The has this declaration on line 17:

    private static final String CREATE="""
       "address_id": "123",
       "item_id": "13"

The build before sonar is successful (compile, test ok) so not sure why sonar fail at this point.


Welcome to the community!

Did you upgrade to version 6.0 of the Java analyzer in January?



I use sonarcloud cloud and there was an upgrade in january.
I use maven plugin

I guess the java analyser is downloaded from sonarcloud so the latest version?

Hi Gregoire,

Given the following code:

public class Hello {
  private static final String CONSTANT= """
  public static void main(String[] args) {

I was able to reproduce the problem using SonarJava (current version on SonarCloud)

Caused by: java.lang.IllegalArgumentException: Unable to create symbol on file src/main/java/
Caused by: java.lang.IllegalArgumentException: 21 is not a valid line offset for pointer. File src/main/java/ has 4 character(s) at line 3
    at org.sonar.api.utils.Preconditions.checkArgument (
    at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid (
    at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer (
    at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange (
    at org.sonar.api.batch.sensor.symbol.internal.DefaultSymbolTable.newSymbol (
    at (

And I was not able to reproduce with the bugfix release that will be deployed soon: SonarJava

It was a piece of good news before I discover that we can also have some problem with the highlighting :man_facepalming:, I created this ticket : SONARJAVA-3285

Thanks for the feedback!