Analyzing JCov coverage using DataMethod functionality

Alexander Kouznetsov alexander.kouznetsov at oracle.com
Fri Oct 31 19:31:41 UTC 2014


Team,

I'm confused. DataMethod has getBlocks() method that returns list of 
blocks. My simple method has 4 blocks. But getBlocks() method returns 
only one.

  18 		

      public  T dequeue() {

  19	 Block: 1/1 	

          if  (head.isEmpty()) {

  20 	 Block: 1/1 Branch: 1/1 	

              while  (!tail.isEmpty()) {

  21 	 Block: 1/1 Branch: 1/1 	

                  head.push(tail.pop());

  22 		

              }

  23 		

          }

  24 	 Block: 1/1 Branch: 2/2 	

          return  head.pop();

  25 		

      }


dataMethod.getBlocks().toString() = [methenter(0,9)@7cbd213e]

Am I misinterpreting the API?

Internally its basicBlocks inside has correct amount of 4 blocks that 
matches to template.xml file however it doesn't help.

I have similar issues with branches and lines.

I've also found this comment in MethodCoverage.java. Could somebody 
please clarify what exactly is legacy and what is the replacement?

     /**
      * Finds coverage items in terms of legacy jcov (blocks and branches)
      */

-- 
Best regards,
Alexander Kouznetsov
(408) 276-0387



More information about the jcov-dev mailing list