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

Negative coverage in report for records

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • None
    • None
    • tools
    • None

      Reproducer:
      --------------------------------------------------------------------
      #!/bin/sh -x
      export PATH=$JAVA_HOME/bin:$PATH
      cat > Main.java <<EOT
      public class Main {
          record Point(int x, int y) {}
          public static void main(String[] args) {
              System.out.println(new Point(0, 0).x);
              System.out.println(new Point(0, 0).y);
          }
      }
      EOT
      javac -d `pwd` Main.java
      if [ ! -d orig ]
      then
          mkdir orig
      fi
      cp *.class orig
      java -jar $JCOV_JAR Instr `find . -name "*.class"`
      java -cp `pwd`:`dirname $JCOV_JAR`/jcov_file_saver.jar Main
      java --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED -jar $JCOV_JAR RepGen -javap orig -o report result.xml
      java --add-exports jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED -jar $JCOV_JAR RepGen -src . -o report_java result.xml
      --------------------------------------------------------------------

      Both reports show line coverage as "-20%(-1/5)"

        1. defectReport.jpg
          defectReport.jpg
          147 kB
        2. fixedReport.jpg
          fixedReport.jpg
          153 kB
        3. negative.png
          negative.png
          9 kB

            lkuskov Leonid Kuskov
            shurailine Aleksandre Iline
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: