Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JaCoCo appears to overcount switch statements #41

Closed
tgoldenatwork opened this issue Nov 9, 2012 · 3 comments
Closed

JaCoCo appears to overcount switch statements #41

tgoldenatwork opened this issue Nov 9, 2012 · 3 comments
Labels
declined: duplicate ❌ This issue or pull request already exists

Comments

@tgoldenatwork
Copy link

I am viewing unit test coverage in Sonar using JaCoCo. For a switch statement with three cases and a default block, with explicit breaks after each case, JaCoCo tells me I need to cover 10 paths. Now, this number would seem to make sense if each case fell through (4 + 3 + 2 + 1) but not when I explicitly break after each. Am I misunderstanding this number, or is this actually incorrect?

@marchof
Copy link
Member

marchof commented Nov 9, 2012

What is the type of the switch variable?

@tgoldenatwork
Copy link
Author

It's a switch over a String, which was introduced in Java 7.

@marchof
Copy link
Member

marchof commented Nov 12, 2012

This a known limitation: The compiler creates a switch statement on the hashcode and an additional equals check on every case. Future versions of JaCoCo might provide a filter for this. See issue #15.

@marchof marchof closed this as completed Nov 12, 2012
pingpongboss pushed a commit to material-motion-archive/family-direct-manipulation-android that referenced this issue Nov 23, 2016
Summary:
Fixes #14

Branch coverage for GesturePerformer#removePlan is not 100% due to jacoco/jacoco#41

Reviewers: O6 Material Motion Android platform reviewers, O2 Material Motion, featherless

Reviewed By: O6 Material Motion Android platform reviewers, O2 Material Motion, featherless

Tags: #material_motion

Differential Revision: http://codereview.cc/D1992
@jacoco jacoco locked and limited conversation to collaborators Jan 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
declined: duplicate ❌ This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants