-
Bug
-
Resolution: Fixed
-
P3
-
jcov_1.4
-
beta3
-
generic
-
generic
-
Not verified
Name: kbR10066 Date: 09/18/2001
With these options enabled, execution counters should be incremented only
for those methods whose callers' class names conform to the filter specified
by the options. But this does not work correctly in jcov in JDK1.4.0beta-b78
and earlier.
To reproduce, compile the following source a.java with -Xjcov switch:
> <JDK1.4.0beta-b78>/solsparc/bin/javac -Xjcov a.java
--- a.java ---
class c {
void foo() {
System.out.println("c.foo()");
}
}
class b {
static void foo() {
new c().foo();
}
}
public class a {
static void foo() {
new c().foo();
}
public static void main(String[] args) {
a.foo();
b.foo();
}
}
--- end of a.java ---
Then run this class with Jcov agent enabled, specifying caller filter to include only class a:
> <JDK1.4.0beta-b78>/solsparc/bin/java -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:caller_include=a -cp . a
Resulting jcov data file java.jcov will report that method a.foo() is executed 2 times, whereas
it should report that the method was executed only one time, since it was invoked only once from
the class a members (second time it was invoked from class b member method foo()) :
--- java.jcov ---
. . .
CLASS: c []
SRCFILE: a.java
TIMESTAMP: 1000810961237
DATA: C
#kind start end count
METHOD: <init>()V []
1 1024 0 2
3 1024 0 2
METHOD: foo()V []
1 2068 4105 2
3 3089 3117 2
. . .
--- end of java.jcov ---
======================================================================