[java code coverage] code coverage and try-finally

2014-12-22 Thread silverio . di
In following code I've got coverage till return but not for finally and related 
code when java actually run it. What is the mistake ?

public String getNodeID() {
mResourcesNodesLock.lock();
try {
return mResourcesNodes.get(LOCAL_RESOURCES_NODE).id;
} finally {
mResourcesNodesLock.unlock();
}
}

-- 
You received this message because you are subscribed to the Google Groups 
JaCoCo and EclEmma Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/0740fa04-0f90-4f4d-863c-9d0ea5ebb580%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [java code coverage] code coverage and try-finally

2014-12-22 Thread Mirko Friedenhagen
Silvio, the java compiler is probably creating multiple branches in byte
code for your source. The number of branches depend on the jdk version.

Just search in your favorite  search engine for jacoco try finally.

Regards
Mirko
-- 
Sent from my mobile
On Dec 22, 2014 9:36 AM, silverio...@gmail.com wrote:

 In following code I've got coverage till return but not for finally and
 related code when java actually run it. What is the mistake ?

 public String getNodeID() {
 mResourcesNodesLock.lock();
 try {
 return
 mResourcesNodes.get(LOCAL_RESOURCES_NODE).id;
 } finally {
 mResourcesNodesLock.unlock();
 }
 }

 --
 You received this message because you are subscribed to the Google Groups
 JaCoCo and EclEmma Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to jacoco+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/jacoco/0740fa04-0f90-4f4d-863c-9d0ea5ebb580%40googlegroups.com
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
JaCoCo and EclEmma Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jacoco+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/CAK8jvqwSBo4Y6NvdfmnNOO_Hf8D04PemVbXYDP0vK7gjhu5DSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.