Error when Clover instrument source code.

Hi,

I am getting the following error when running cloverinstr to instrument source code.

Exception: D:\Source\...\CacheClient.java:92:20:expecting SEMI, found ','

at com.cenqua.clover.instr.Instrumenter.instrument(Instrumenter.java:155)

at org.apache.tools.ant.taskdefs.CloverCompilerAdapter.setJavac(CloverCompilerAdapter.java:339)

at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1094)

at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:906)

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

at org.apache.tools.ant.Task.perform(Task.java:348)

at org.apache.tools.ant.Target.execute(Target.java:390)

at org.apache.tools.ant.Target.performTasks(Target.java:411)

at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)

at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)

at org.apache.tools.ant.Project.executeTargets(Project.java:1249)

at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)

at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:302)

at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:221)

at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)

at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:601)

at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

at org.apache.tools.ant.Task.perform(Task.java:348)

at org.apache.tools.ant.Target.execute(Target.java:390)

at org.apache.tools.ant.Target.performTasks(Target.java:411)

at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)

at org.apache.tools.ant.Project.executeTarget(Project.java:1366)

at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)

at org.apache.tools.ant.Project.executeTargets(Project.java:1249)

at org.apache.tools.ant.Main.runBuild(Main.java:801)

at org.apache.tools.ant.Main.startAnt(Main.java:218)

at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)

at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

The line that Clover complains about looks like this,

Map<Integer, ProduAvailability> results = new HashMap<>();

Not sure what is wrong. Encoding problem?

2 answers

Hi,

What is your Clover version? What java version is your source compatible with?

If you use Java 7 features and old Clover version then it may result in similar issues.

Cheers,
Jacek

I know this is really old, but I wanted to contribute a solution for future reference since I ran into this myself.

Change this:

Map<Integer, ProduAvailability> results = new HashMap<>();

To this:

Map<Integer, ProduAvailability> results = new HashMap();

 

As Jack implies the version of Clover you are using doesn't support Java 7 features. You can find info about the diamond operator here:

http://stackoverflow.com/questions/4166966/what-is-the-point-of-the-diamond-operator-in-java-7

Joseph Elwell.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

61 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you