Is the SonarQube Java analyser supposed to be able to analyse semantically incorrect Java source code? -
given following java source code,
public class test { private static int a; private static int a; }
you run error while analyzing, expected? think should log parser failure, not stop analysis, right?
error: error during sonar runner execution org.sonar.runner.impl.runnerexception: unable execute sonar @ org.sonar.runner.impl.batchlauncher$1.delegateexecution(batchlauncher.java:91) @ org.sonar.runner.impl.batchlauncher$1.run(batchlauncher.java:75) @ java.security.accesscontroller.doprivileged(native method) @ org.sonar.runner.impl.batchlauncher.doexecute(batchlauncher.java:69) @ org.sonar.runner.impl.batchlauncher.execute(batchlauncher.java:50) @ org.sonar.runner.api.embeddedrunner.doexecute(embeddedrunner.java:102) @ org.sonar.runner.api.runner.execute(runner.java:100) @ org.sonar.runner.main.executetask(main.java:70) @ org.sonar.runner.main.execute(main.java:59) @ org.sonar.runner.main.main(main.java:53) caused by: org.sonar.squidbridge.api.analysisexception: sonarqube unable analyze file : '/home/administrator/tmp/frameworks/av/test.java' @ org.sonar.java.ast.javaastscanner.simplescan(javaastscanner.java:102) @ org.sonar.java.ast.javaastscanner.scan(javaastscanner.java:75) @ org.sonar.java.javasquid.scansources(javasquid.java:131) @ org.sonar.java.javasquid.scan(javasquid.java:124) @ org.sonar.plugins.java.javasquidsensor.analyse(javasquidsensor.java:86) @ org.sonar.batch.phases.sensorsexecutor.executesensor(sensorsexecutor.java:59) @ org.sonar.batch.phases.sensorsexecutor.execute(sensorsexecutor.java:51) @ org.sonar.batch.phases.databasemodephaseexecutor.execute(databasemodephaseexecutor.java:120) @ org.sonar.batch.scan.modulescancontainer.doafterstart(modulescancontainer.java:264) @ org.sonar.api.platform.componentcontainer.startcomponents(componentcontainer.java:92) @ org.sonar.api.platform.componentcontainer.execute(componentcontainer.java:77) @ org.sonar.batch.scan.projectscancontainer.scan(projectscancontainer.java:235) @ org.sonar.batch.scan.projectscancontainer.scanrecursively(projectscancontainer.java:230) @ org.sonar.batch.scan.projectscancontainer.doafterstart(projectscancontainer.java:220) @ org.sonar.api.platform.componentcontainer.startcomponents(componentcontainer.java:92) @ org.sonar.api.platform.componentcontainer.execute(componentcontainer.java:77) @ org.sonar.batch.scan.scantask.scan(scantask.java:57) @ org.sonar.batch.scan.scantask.execute(scantask.java:45) @ org.sonar.batch.bootstrap.taskcontainer.doafterstart(taskcontainer.java:135) @ org.sonar.api.platform.componentcontainer.startcomponents(componentcontainer.java:92) @ org.sonar.api.platform.componentcontainer.execute(componentcontainer.java:77) @ org.sonar.batch.bootstrap.globalcontainer.executetask(globalcontainer.java:158) @ org.sonar.batch.bootstrapper.batch.executetask(batch.java:95) @ org.sonar.batch.bootstrapper.batch.execute(batch.java:67) @ org.sonar.runner.batch.isolatedlauncher.execute(isolatedlauncher.java:48) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.sonar.runner.impl.batchlauncher$1.delegateexecution(batchlauncher.java:87) ... 9 more caused by: java.lang.illegalargumentexception: duplicate key: @ com.google.common.base.preconditions.checkargument(preconditions.java:115) @ com.google.common.collect.regularimmutablemap.<init>(regularimmutablemap.java:72) @ com.google.common.collect.immutablemap$builder.fromentrylist(immutablemap.java:221) @ com.google.common.collect.immutablemap$builder.build(immutablemap.java:207) @ org.sonar.java.checks.hiddenfieldcheck.visitnode(hiddenfieldcheck.java:94) @ org.sonar.java.ast.visitors.subscriptionvisitor.visit(subscriptionvisitor.java:89) @ org.sonar.java.ast.visitors.subscriptionvisitor.visitchildren(subscriptionvisitor.java:115) @ org.sonar.java.ast.visitors.subscriptionvisitor.visit(subscriptionvisitor.java:91) @ org.sonar.java.ast.visitors.subscriptionvisitor.scantree(subscriptionvisitor.java:72) @ org.sonar.java.ast.visitors.subscriptionvisitor.scanfile(subscriptionvisitor.java:65) @ org.sonar.java.checks.subscriptionbasevisitor.scanfile(subscriptionbasevisitor.java:33) @ org.sonar.java.checks.hiddenfieldcheck.scanfile(hiddenfieldcheck.java:80) @ org.sonar.java.model.visitorsbridge.visitfile(visitorsbridge.java:123) @ org.sonar.java.ast.javaastscanner.simplescan(javaastscanner.java:94) ... 38 more
this source code can't compiled , don't expect sonarqube java analyser able analyse piece of code. error message should bit more meaningful. i've created following jira ticket: http://jira.sonarsource.com/browse/sonarjava-1182
Comments
Post a Comment