Name: dkR10031 Date: 06/20/2003
Current implementation of the Merger generates incorrect
coverage data for the 'strictfp' classes. When it is called
with '-fp=strictfp', classes having the 'strictfp' modifier should
be included to the resulting datafile file since Jcov User Guide
reads in section "B.5 Merger Utility Syntax":
"-fm=modifier: Only classes having the specified modifier
will be included in the resulting file. Can be specified
multiple times."
However, the result coverage file does not contain expected
coverage data for the 'strictfp' classes.
To reproduce this bug please run the following example using script
below. This script compiles the source which contains 'strictfp' class A,
instruments the test classes using the static instrumenter, invokes merger
with the '-fm=strictfp' options and finally dumps result merger.jcov
coverage datafile. Please see merger.jcov file. It should contain
coverage data for the A class but it does not:
-------------------------- test.java source begin --------------------
strictfp class A {
public static strictfp void foo() {
System.out.println("A");
}
}
public class test {
public static void main(String[] args) {
A.foo();
System.out.println("-----------");
System.exit(0);
}
}
-------------------------- test.java source end ----------------------
-------------------------- script begin ------------------------------
#!/bin/ksh
# Set classpath
JCOV_JAR=/export/home/gary/QA.JCOV/ws-test/test.linux-x86/lib/jcov.jar
TESTED_JAVA=/export/home/jdk1.4.1/linux/bin/java
TESTED_JAVAC=/export/home/jdk1.4.1/linux/bin/javac
CLASSPATH=${JCOV_JAR}
CLASSPATH=${CLASSPATH}:.
export CLASSPATH
# Compile the test program
$TESTED_JAVAC -Xjcov test.java
# For the Static Instrumentation mechanism: Instrument the test program
$TESTED_JAVA -showversion com.sun.tdk.jcov.InstrMain -savebefore=java.lang.System.exit -overwrite test.class A.class
$TESTED_JAVA -showversion test
# Run the Merger to merge coverage files with the -output option
$TESTED_JAVA -showversion com.sun.tdk.jcov.MergerMain -output=merger.jcov -fm=strictfp java.jcov
echo "-------- merger.jcov dump begin ---------"
cat merger.jcov
echo "-------- merger.jcov dump end ---------"
-------------------------- script end --------------------------------
-------------------------- output begin ------------------------------
[gary@linux-11 #xxxxxxxx(5)]# uname -a
Linux linux-11 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
GNU/Linux
[gary@linux-11 #xxxxxxxx(5)]# ./run.ksh
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
A
-----------
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
-------- merger.jcov dump begin ---------
JCOV-DATA-FILE-VERSION: 2.0
-------- merger.jcov dump end ---------
-------------------------- output end --------------------------------
======================================================================
Name: kbR10066 Date: 07/15/2003
JCov coverage file generated by an instrumented app or a template generator
does not preserve 'strictfp' method modifier. (See evaluation).
======================================================================