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

Error thrown in SonarLint on files that are syntactically correct but don't compile

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Plugin
    • Labels:
      None

      Description

      Given a sample file like this:

      package its;public class MyTest {int a;int a;}
      

      SonarJava in SonarLint fails with:

      1 source files to be analyzed
      Unable to create symbol table for : /tmp/junit9061997391740221748/junit5528732718692719982/MyTest.java
      java.lang.IllegalStateException: Registering symbol: 'a' twice in the same scope
              at com.google.common.base.Preconditions.checkState(Preconditions.java:199) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.Scope.enter(Scope.java:54) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.FirstPass.enterSymbol(FirstPass.java:515) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.FirstPass.declareVariable(FirstPass.java:429) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.FirstPass.visitVariable(FirstPass.java:369) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.model.declaration.VariableTreeImpl.accept(VariableTreeImpl.java:185) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.FirstPass.visitClass(FirstPass.java:264) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.model.declaration.ClassTreeImpl.accept(ClassTreeImpl.java:202) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:43) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:37) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.FirstPass.visitCompilationUnit(FirstPass.java:128) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:64) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:105) ~[sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:96) [sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:68) [sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:120) [sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.java.JavaSquid.scan(JavaSquid.java:114) [sonar-java-plugin-5.0.1.12818.jar:na]
              at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:91) [sonar-java-plugin-5.0.1.12818.jar:na]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                janos.gyerik Janos Gyerik
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: