Jacoco unit test coverage false positive issue on try-with-resources

510 views
Skip to first unread message

Nick Radov

unread,
Oct 18, 2016, 7:16:50 PM10/18/16
to SonarQube
We are getting false positive issues on the Java rule "Branches should have sufficient coverage by unit tests" when using try-with-resources syntax. I think this might be caused by Jacoco issue #82. Essentially javac is generating byte code with extra branches that aren't exposed for unit testing. Is there a recommended way to deal with this in SonarQube?

Nicolas Peru

unread,
Oct 19, 2016, 2:52:29 AM10/19/16
to Nick Radov, SonarQube
Hi Nick, 

(Always nice to use greetings, helps to make communication smoother).
There is no special recommended way to deal with this in SonarQube. This is a limitation of JaCoCo and so the ball is on their side on that matter. 

Cheers, 

Le mer. 19 oct. 2016 à 01:16, Nick Radov <nick....@optum.com> a écrit :
We are getting false positive issues on the Java rule "Branches should have sufficient coverage by unit tests" when using try-with-resources syntax. I think this might be caused by Jacoco issue #82. Essentially javac is generating byte code with extra branches that aren't exposed for unit testing. Is there a recommended way to deal with this in SonarQube?

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/05ef10bb-6ce8-4563-8858-b38a2fbf518a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com
Reply all
Reply to author
Forward
0 new messages