Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7900441

Negative execution counters may occur in coverage file

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: kbR10066 Date: 04/10/2003


      JCov agent may sometimes produce coverage files with
      negative execution counters, which is obviously incorrect
      behavor. Besides, such coverage files confuse other JCov
      utilities.

      To reproduce:

      1. Compile the following source (a.java):
      % <JDK14>/bin/javac a.java

      --- a.java ---
      public class a {
      public static void main(String[] args) {
      System.out.println("Hello world!");
      }
      }
      --- end of a.java ---

      2. Create the following coverage file (java.jcov) in current directory:

      --- java.jcov ---
      JCOV-DATA-FILE-VERSION: 2.0
      CLASS: a [public]
      SRCFILE: a.java
      TIMESTAMP: 0
      DATA: M
      #kind line position count
      METHOD: <init>()V [public]
      1 1 0 0
      METHOD: main([Ljava/lang/String;)V [public static]
      1 3 0 2147483648
      --- end of java.jcov ---

      3. Run class a under -Xrunjcov:
      % <JDK14>/bin/java -Xrunjcov:t=m -cp . a

      The following coverage file will be produced (java.jcov):

      --- java.jcov ---
      JCOV-DATA-FILE-VERSION: 2.0
      CLASS: a [public]
      SRCFILE: a.java
      TIMESTAMP: 0
      DATA: M
      #kind line position count
      METHOD: <init>()V [public]
      1 1 0 0
      METHOD: main([Ljava/lang/String;)V [public static]
      1 3 0 -2147483647
      --- end of java.jcov ---

      Note the '-2147483647' execution counter.
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            afedorch Alexey Fedorchenko (Inactive)
            Reporter:
            klooney Kevin Looney (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: