[4.3.1] Clover seems incompatible with Google Guice: unexpected token: bind

Issue #78 duplicate
Luiz Felipe Zafra Saggioro created an issue

I'm trying to run clover on my project that depends on Google Guice

<dependency>
    <groupId>com.google.inject</groupId>
    <artifactId>guice</artifactId>
    <version>4.1.0</version>
</dependency>

When I run

mvn clean org.openclover:clover-maven-plugin:setup

I get the following error:

[INFO] Instrumentation error
com.atlassian.clover.api.CloverException: /home/user/workspaces/project/package/JavaFile.java:30:3:unexpected token: bind
    at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:159)
    at com.atlassian.clover.CloverInstr.execute(CloverInstr.java:76)
    at com.atlassian.clover.CloverInstr.mainImpl(CloverInstr.java:54)
    at com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrumentSources(AbstractInstrumenter.java:197)
    at com.atlassian.maven.plugin.clover.internal.instrumentation.AbstractInstrumenter.instrument(AbstractInstrumenter.java:72)
    at com.atlassian.maven.plugin.clover.CloverInstrumentInternalMojo.execute(CloverInstrumentInternalMojo.java:289)
    at com.atlassian.maven.plugin.clover.CloverSetupMojo.execute(CloverSetupMojo.java:31)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: line 30:3: unexpected token: bind
    at com.atlassian.clover.instr.java.JavaRecognizer.conditionalExpression(JavaRecognizer.java:4852)
    at com.atlassian.clover.instr.java.JavaRecognizer.assignmentExpression(JavaRecognizer.java:4719)
    at com.atlassian.clover.instr.java.JavaRecognizer.expression(JavaRecognizer.java:3784)
    at com.atlassian.clover.instr.java.JavaRecognizer.statement(JavaRecognizer.java:3307)
    at com.atlassian.clover.instr.java.JavaRecognizer.outerCompoundStmt(JavaRecognizer.java:3094)
    at com.atlassian.clover.instr.java.JavaRecognizer.field(JavaRecognizer.java:2663)
    at com.atlassian.clover.instr.java.JavaRecognizer.classBlock(JavaRecognizer.java:2126)
    at com.atlassian.clover.instr.java.JavaRecognizer.classDefinition(JavaRecognizer.java:1134)
    at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition2(JavaRecognizer.java:1064)
    at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition(JavaRecognizer.java:968)
    at com.atlassian.clover.instr.java.JavaRecognizer.compilationUnit(JavaRecognizer.java:880)
    at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:211)
    at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:124)
    ... 28 more

The refered line is

public class JavaFile extends AbstractModule {
    @Override
    protected void configure() {
        bind(SomeClass.class).to(SomeClassImpl.class); // this is line 30
    }

where AbstractModule is from com.google.inject.AbstractModule

Is there any workaround for that?

Comments (4)

  1. Log in to comment