Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Coverage report shows less than 100% #56

Closed
balazs-zsoldos opened this issue Jun 29, 2013 · 1 comment
Closed

Coverage report shows less than 100% #56

balazs-zsoldos opened this issue Jun 29, 2013 · 1 comment

Comments

@balazs-zsoldos
Copy link

I wrote a module that is tested and coverage tests are created with jacoco. There is the following code snippet:

    ReadLock readLock = eventsToReplayLocker.readLock();
    readLock.lock();
    try {
        eventsWithReplayFlag = new ArrayList<EventWithReplayFlag<E>>(eventsToReplay.values());
    } finally {
        readLock.unlock();
    }

All lines are green except the one in the finally block that is yellow and code coverage is not 100%. I do not see any information why it is not green. The code runs on that line for sure as it is in a finally block.

To reproduce:

@marchof
Copy link
Member

marchof commented Jun 30, 2013

Thanks for reporting this! Actually this is known behavior. JaCoCo (the library behind EclEmma) works on Java class files. The compiler creates two paths for finally blocks: One path for the exception case and another one for the non-exception case. Yellow means that one of the two paths is not covered by your test scenarion.

We have a feature request to filter certain compiler artifacts like the one you entcountered: jacoco/jacoco#15

There is also a JaCoCo/EclEmma fork which already implements filtering of finally blocks: http://mchr3k.github.io/jacoco/

@marchof marchof closed this as completed Jun 30, 2013
@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.
Projects
None yet
Development

No branches or pull requests

2 participants