You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No Coverage for branch/stack containing call of System.exit() #117
jacoco does not show full coverage for the following code. It's a bit strange that the call to System.out.println is not shown as covered, while the generation of the RuntimeExceoption from within callExit is.
public static void main(String[] args) {
try {
callExit(false);
throw new RuntimeException();
} catch (RuntimeException re) {
System.out.println("test");
callExit(true);
}
}
public static void callExit(boolean exit) {
if (exit) {
try {
throw new RuntimeException();
} catch (RuntimeException re) {
System.exit(1);
}
} else {
String x = "bla";
}
}
JaCoCo determines code execution with so called probes. Probes are inserted into the control flow at certain positions. Code is considered as executed when a subsequent probe has been executed. In case of exceptions such a sequence of instructions is aborted somewhere in the middle and not marked as executed.
Activity
marchof commentedon Jul 22, 2013
This is known limitation. Code which does not return -- which is the case for System.exit() -- is not shown as covered:
See FAQ:
Code with exceptions shows no coverage. Why?
JaCoCo determines code execution with so called probes. Probes are inserted into the control flow at certain positions. Code is considered as executed when a subsequent probe has been executed. In case of exceptions such a sequence of instructions is aborted somewhere in the middle and not marked as executed.