Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cbi-dev] Tycho + Sonar: No coverage on SonarQube due to missing javax.annotation.Nullable

Hi,

I hope this is the right mailing list for this kind of question, as it
relates to Tycho and Sonar as used in our Hudson build jobs.

We (Eclipse Code Recommenders) have the problem that certain classes in
our build do not show test coverage in SonarQube. Looking at [1],
CallCompletionSessionProcessor.java does not show any coverage (not even
0.0%), even though there are tests (most notably
CallCompletionSessionProcessorTest) exercising it.

When going through our HIPP's console log [2], I found the following:

> [INFO] [04:06:35.918] -------------  Scan org.eclipse.recommenders.calls.rcp
> [INFO] [04:06:35.919] Load module settings
> [INFO] [04:06:35.999] Configure Maven plugins
> [INFO] [04:06:36.001] Compare to previous analysis (2015-05-19)
> [INFO] [04:06:36.003] Compare over 30 days (2015-04-19, analysis of 2015-04-20 12:59:34.0)
> [INFO] [04:06:36.004] Compare to previous version (2015-04-23)
> [INFO] [04:06:36.005] No quality gate is configured.
> [INFO] [04:06:36.028] Initializer FindbugsMavenInitializer...
> [INFO] [04:06:36.028] Initializer FindbugsMavenInitializer done: 0 ms
> [INFO] [04:06:36.028] Base dir: /home/hudson/genie.recommenders/.hudson/jobs/org.eclipse.recommenders-sonar/workspace/plugins/org.eclipse.recommenders.calls.rcp
> [INFO] [04:06:36.028] Working dir: /home/hudson/genie.recommenders/.hudson/jobs/org.eclipse.recommenders-sonar/workspace/plugins/org.eclipse.recommenders.calls.rcp/target/sonar
> [INFO] [04:06:36.028] Source paths: pom.xml, src
> [INFO] [04:06:36.028] Binary dirs: target/classes
> [INFO] [04:06:36.028] Source encoding: UTF-8, default locale: en_US
> [INFO] [04:06:36.028] Index files
> [INFO] [04:06:36.046] 18 files indexed
> [INFO] [04:06:36.406] Quality profile for java: Sonar way with Findbugs
> [INFO] [04:06:36.409] Sensor JavaSquidSensor...
> [INFO] [04:06:36.452] Java Main Files AST scan...
> [INFO] [04:06:36.452] 18 source files to be analyzed
> [ERROR] [04:06:36.518] Class not found: javax.annotation.Nullable
> [ERROR] [04:06:36.715] Class not found: javax.annotation.Nullable
> [ERROR] [04:06:36.901] Class not found: javax.annotation.Nullable
> [ERROR] [04:06:36.944] Unable to create symbol table for : /home/hudson/genie.recommenders/.hudson/jobs/org.eclipse.recommenders-sonar/workspace/plugins/org.eclipse.recommenders.calls.rcp/src/org/eclipse/recommenders/internal/calls/rcp/CallCompletionSessionProcessor.java
> java.lang.IllegalStateException: Could not resolve type parameter: T in class Recommendations
> 	at com.google.common.base.Preconditions.checkState(Preconditions.java:145) ~[sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.java.resolve.BytecodeVisitor$ReadType.visitTypeVariable(BytecodeVisitor.java:534) ~[java-squid-3.2.jar:na]
> 	at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:169) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:219) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.objectweb.asm.signature.SignatureReader.accept(SignatureReader.java:87) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.sonar.java.resolve.BytecodeVisitor.visitMethod(BytecodeVisitor.java:215) ~[java-squid-3.2.jar:na]
> 	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:911) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.objectweb.asm.ClassReader.accept(ClassReader.java:693) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.objectweb.asm.ClassReader.accept(ClassReader.java:506) ~[asm-debug-all-5.0.3.jar:5.0.3]
> 	at org.sonar.java.resolve.BytecodeCompleter.complete(BytecodeCompleter.java:103) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.JavaSymbol.complete(JavaSymbol.java:104) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.JavaSymbol$TypeJavaSymbol.members(JavaSymbol.java:312) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.FirstPass$ImportResolverVisitor.visitIdentifier(FirstPass.java:199) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.model.expression.IdentifierTreeImpl.accept(IdentifierTreeImpl.java:83) ~[java-squid-3.2.jar:na]
> 	at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.2.jar:na]
> 	at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitMemberSelectExpression(BaseTreeVisitor.java:228) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.model.expression.MemberSelectExpressionTreeImpl.accept(MemberSelectExpressionTreeImpl.java:111) ~[java-squid-3.2.jar:na]
> 	at org.sonar.plugins.java.api.tree.BaseTreeVisitor.scan(BaseTreeVisitor.java:42) ~[java-squid-3.2.jar:na]
> 	at org.sonar.plugins.java.api.tree.BaseTreeVisitor.visitImport(BaseTreeVisitor.java:60) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.FirstPass$ImportResolverVisitor.visitImport(FirstPass.java:154) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.model.JavaTree$ImportTreeImpl.accept(JavaTree.java:300) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.FirstPass.resolveImports(FirstPass.java:140) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.FirstPass.visitCompilationUnit(FirstPass.java:117) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.resolve.SemanticModel.createFor(SemanticModel.java:65) ~[java-squid-3.2.jar:na]
> 	at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:110) ~[java-squid-3.2.jar:na]
> 	at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67) [sslr-core-1.20.jar:na]
> 	at org.sonar.java.ast.AstScanner.simpleScan(AstScanner.java:107) [java-squid-3.2.jar:na]
> 	at org.sonar.java.ast.AstScanner.scan(AstScanner.java:75) [java-squid-3.2.jar:na]
> 	at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:132) [java-squid-3.2.jar:na]
> 	at org.sonar.java.JavaSquid.scan(JavaSquid.java:125) [java-squid-3.2.jar:na]
> 	at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:86) [sonar-java-plugin-3.2.jar:na]
> 	at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) [sonar-batch-maven-compat-4.5.4.jar:na]
> 	at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) [sonar-runner-batch4315276506515872822.jar:na]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_75]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_75]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_75]
> 	at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_75]
> 	at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) [sonar-runner-api-2.4.jar:na]
> 	at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) [sonar-runner-api-2.4.jar:na]
> 	at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_75]
> 	at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) [sonar-runner-api-2.4.jar:na]
> 	at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) [sonar-runner-api-2.4.jar:na]
> 	at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) [sonar-runner-api-2.4.jar:na]
> 	at org.sonar.runner.api.Runner.execute(Runner.java:100) [sonar-runner-api-2.4.jar:na]
> 	at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135) [sonar-maven-plugin-2.5.jar:na]
> 	at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:138) [sonar-maven-plugin-2.5.jar:na]
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) [maven-core-3.3.1.jar:3.3.1]
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) [maven-embedder-3.3.1.jar:3.3.1]
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) [maven-embedder-3.3.1.jar:3.3.1]
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) [maven-embedder-3.3.1.jar:3.3.1]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_75]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_75]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_75]
> 	at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_75]
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) [plexus-classworlds-2.5.2.jar:na]
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) [plexus-classworlds-2.5.2.jar:na]
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) [plexus-classworlds-2.5.2.jar:na]
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [plexus-classworlds-2.5.2.jar:na]

Apparently, the @Nullable annotation (with has runtime retention, FWIW)
is not on the analysis classpath, although the com.google.guava 15.0.0
bundle from Orbit declares an optional dependency on the
javax.annotation package.

> Import-Package: javax.annotation;resolution:=optional,javax.inject;res
>  olution:=optional,sun.misc;resolution:=optional

If I interpret this correctly, I need Tycho to communicate the classpath
in such a way to Sonar that it sees the optional dependency (which is in
our target platform, BTW). Any pointers how to do that are greatly
appreciated.

Best wishes,

Andreas

[1] <https://dev.eclipse.org/sonar/components/index?id=22702>
[2]
<https://hudson.eclipse.org/recommenders/job/org.eclipse.recommenders-sonar/37/consoleFull>

-- 
Codetrails GmbH
The knowledge transfer company

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940


Back to the top