changeset 6:65addecd4439

Summary: CODETOOLS-7900390. diffCoverage add "no information" for incorrect(not full) result.xml Contributed by: alexey.fedorchenko@oracle.com
author ersh
date Wed, 02 Jul 2014 18:43:51 +0400
parents 69479337637d
children cbeca9e4fbe3
files src/classes/com/sun/tdk/jcov/DiffCoverage.java
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/classes/com/sun/tdk/jcov/DiffCoverage.java	Tue Jul 01 18:25:55 2014 +0400
+++ b/src/classes/com/sun/tdk/jcov/DiffCoverage.java	Wed Jul 02 18:43:51 2014 +0400
@@ -63,6 +63,7 @@
         private int line;
         private String source;
         boolean checked;
+        boolean codeByDefault = true;
 
         public SourceLine(int line, String source) {
             this.line = line;
@@ -153,7 +154,7 @@
             }
         });
 
-        int notCovered = 0, covered = 0, nonCode = 0;
+        int notCovered = 0, covered = 0, nonCode = 0, noInformation = 0;
         for (DataPackage p : data.getPackages()) {
             HashMap<String, ArrayList<ClassCoveragePair>> classesMap = new HashMap<String, ArrayList<ClassCoveragePair>>();
             for (DataClass c : p.getClasses()) {
@@ -228,13 +229,26 @@
 
                     for (SourceLine line : lines) {
                         if (!line.checked) {
+                            line.codeByDefault = false;
                             ++nonCode;
                         }
                     }
                 }
             }
         }
-        System.out.println(String.format("lines: %d new; %d covered; %d not covered; %d not code", nonCode + notCovered + covered, covered, notCovered, nonCode));
+
+        for (String diffClasses : sources.keySet()){
+            for (SourceLine line: sources.get(diffClasses)){
+                if (!line.checked && line.codeByDefault){
+                    noInformation++;
+                    if (all) {
+                        System.out.println(String.format("? %6d |%s", line.line, line.source));
+                    }
+                }
+            }
+        }
+
+        System.out.println(String.format("lines: %d new; %d covered; %d not covered; %d not code; %d no information", nonCode + notCovered + covered + noInformation, covered, notCovered, nonCode, noInformation));
 
         return SUCCESS_EXIT_CODE;
     }