自从使用SonarRunner测量Java代码后,迁移到SonarQube 5.1后,我们得到以下 NullPointerException 。在以前的版本SonarQube 4.4中,一切正常。
我们正在使用:
例外:
[exec] 09:52:41.821 ERROR - Unable to create symbol table for : /opt/sqcdev/rzbra/0000005040_RSFX_JAVAEE/RSFX/src/xxx/client/ui/widget/patterns/DialogDetailPresenterIF.java
[exec] java.lang.NullPointerException: null
[exec] at org.sonar.java.resolve.Resolve.findMemberType(Resolve.java:201) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.Resolve.findIdentInType(Resolve.java:339) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.TypeAndReferenceSolver.getSymbolOfMemberSelectExpression(TypeAndReferenceSolver.java:306) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:265) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.TypeAndReferenceSolver.resolveAs(TypeAndReferenceSolver.java:248) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.SecondPass.resolveType(SecondPass.java:223) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.SecondPass.completeTypeParameters(SecondPass.java:150) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.SecondPass.complete(SecondPass.java:87) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.SecondPass.complete(SecondPass.java:60) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.JavaSymbol.complete(JavaSymbol.java:104) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.BytecodeVisitor$ReadType.visitEnd(BytecodeVisitor.java:544) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.BytecodeVisitor$ReadGenericSignature$2.visitEnd(BytecodeVisitor.java:344) ~[java-squid-3.3.jar:na]
[exec] at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:189) ~[asm-debug-all-5.0.3.jar:5.0.3]
[exec] at org.objectweb.asm.signature.SignatureReader.accept(SignatureReader.java:110) ~[asm-debug-all-5.0.3.jar:5.0.3]
[exec] at org.sonar.java.resolve.BytecodeVisitor.visit(BytecodeVisitor.java:75) ~[java-squid-3.3.jar:na]
[exec] at org.objectweb.asm.ClassReader.accept(ClassReader.java:622) ~[asm-debug-all-5.0.3.jar:5.0.3]
[exec] at org.objectweb.asm.ClassReader.accept(ClassReader.java:506) ~[asm-debug-all-5.0.3.jar:5.0.3]
[exec] at org.sonar.java.resolve.BytecodeCompleter.complete(BytecodeCompleter.java:103) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.JavaSymbol.complete(JavaSymbol.java:104) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.JavaSymbol$TypeJavaSymbol.members(JavaSymbol.java:312) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.FirstPass$ImportResolverVisitor.visitIdentifier(FirstPass.java:200) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.model.expression.IdentifierTreeImpl.accept(IdentifierTreeImpl.java:83) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitMemberSelectExpression(BaseTreeVisitor.java:228) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.model.expression.MemberSelectExpressionTreeImpl.accept(MemberSelectExpressionTreeImpl.java:111) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitImport(BaseTreeVisitor.java:60) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.FirstPass$ImportResolverVisitor.visitImport(FirstPass.java:155) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.model.JavaTree$ImportTreeImpl.accept(JavaTree.java:301) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.FirstPass.resolveImports(FirstPass.java:141) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.FirstPass.visitCompilationUnit(FirstPass.java:118) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:65) ~[java-squid-3.3.jar:na]
[exec] at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:110) ~[java-squid-3.3.jar:na]
[exec] at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67) [sslr-core-1.20.jar:na]
[exec] at org.sonar.java.ast.AstScanner.simpleScan(AstScanner.java:107) [java-squid-3.3.jar:na]
[exec] at org.sonar.java.ast.AstScanner.scan(AstScanner.java:75) [java-squid-3.3.jar:na]
[exec] at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:132) [java-squid-3.3.jar:na]
[exec] at org.sonar.java.JavaSquid.scan(JavaSquid.java:125) [java-squid-3.3.jar:na]
[exec] at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:86) [sonar-java-plugin-3.3.jar:na]
[exec] at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:59) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:51) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.phases.DatabaseModePhaseExecutor.execute(DatabaseModePhaseExecutor.java:120) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:264) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:220) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) [sonar-batch-maven-compat-5.1.jar:na]
[exec] at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45) [sonar-runner-batch6321932119626556336.jar:na]
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_25]
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_25]
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_25]
[exec] at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_25]
[exec] at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-runner-dist-2.3.jar:na]
[exec] at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_25]
[exec] at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.api.Runner.execute(Runner.java:90) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.Main.executeTask(Main.java:70) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.Main.execute(Main.java:59) [sonar-runner-dist-2.3.jar:na]
[exec] at org.sonar.runner.Main.main(Main.java:41) [sonar-runner-dist-2.3.jar:na]
Java代码:
package xxx.client.ui.widget.patterns;
import xxx.client.ui.widget.patterns.DialogDetailPresenter.SaveMode;
//@formatter:off
public interface DialogDetailPresenterIF<MB, DB, M, V extends DialogDetailPresenter.DialogDetailViewIF>
extends DetailPresenterIF<MB, DB, M, V>
//@formatter:on
{
/**
* Set behavior of dialog after saving.
*
* @param mode Save mode
* @since 2.1.0
*/
void setSaveMode(SaveMode mode);
/**
* Get behavior of dialog after saving.
* @return 2.1.0
*/
SaveMode getSaveMode();
}