Hi, the yellow line is an artifact of the underlying coverage technology which is based on byte code instrumentation. "Finally" statements only exist in Java source code, the Java compiler creates corresponding control structured in byte code. The finally block is actually executed in two different cases: In case of normal execution and in case of an exception within the try block. You're test code follows only one the these paths, therefor the line is marked yellow (partial execution).
I understand the yellow, but how come the "finally" itself is colored red when it's only executed via the non-exception path (EMMA doesn't color it, or at least in the FAQ it doesn't)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A red line simply means "the compiler has generated a block of code for this particular line which has not been executed". While the source/bytecode mapping works pretty well in most cases, the bytecode generated for finally statement seems to be very compiler specific (the Java VM doesn't know about try/catch/finally statements, it's all table driven).
For deeper understanding I recommend the byte code outline plugin:
I use eclEmma and I like her, but I see a problem this week.
in my blog I write this post http://thinkabouttests.blogspot.com/2008/04/eclemma-e-seus-problemas-com-o-finally.html (I know that is portuguese, but we can try it)
the class StupidClass have this block finally:
finally
{
System.out.println("ok!");
}
but when I execute the test method, this code show me yellowish, and I know that this code is executed by my test.
ps.sorry for my english, but in my language I dont found solutions
[]'s
Hi, the yellow line is an artifact of the underlying coverage technology which is based on byte code instrumentation. "Finally" statements only exist in Java source code, the Java compiler creates corresponding control structured in byte code. The finally block is actually executed in two different cases: In case of normal execution and in case of an exception within the try block. You're test code follows only one the these paths, therefor the line is marked yellow (partial execution).
See EMMA FAQ for more possible artifacts:
http://emma.sourceforge.net/faq.html#q.fractional.examples
-marc
I understand the yellow, but how come the "finally" itself is colored red when it's only executed via the non-exception path (EMMA doesn't color it, or at least in the FAQ it doesn't)?
A red line simply means "the compiler has generated a block of code for this particular line which has not been executed". While the source/bytecode mapping works pretty well in most cases, the bytecode generated for finally statement seems to be very compiler specific (the Java VM doesn't know about try/catch/finally statements, it's all table driven).
For deeper understanding I recommend the byte code outline plugin:
http://andrei.gmxhome.de/bytecode/index.html
-marc