Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3285

Java 13/14 preview feature "Text Block" produce highlighting IllegalArgumentException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.2
    • Fix Version/s: 6.9
    • Component/s: Plugin

      Description

      Given the following context:

      • SonarQube¬†8.1.0.31237
      • SonarJava¬†6.0.2
      • maven-compiler-plugin 3.8.1 (with <release>13</release> and <compilerArgs>--enable-preview</compilerArgs>)

      When analyzing the following source code:

      public class A {
        String CONSTANT= """
          """;
        // comment
      }
      

      SonarJava raises the following exception:

      Caused by: java.lang.IllegalArgumentException: 12 is not a valid line offset for pointer. File src/main/java/A.java has 8 character(s) at line 3
      	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
      	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:339)
      	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
      	at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:288)
      	at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:95)
      

        Attachments

          Activity

            People

            Assignee:
            evgeny.mandrikov Evgeny Mandrikov
            Reporter:
            alban.auzeill Alban Auzeill
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: