Two cobertura questions

View: New views
3 Messages — Rating Filter:   Alert me  

Two cobertura questions

by Balazs Attila-Mihaly (Cd-MaN) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everybody.

I would like to use Cobertura to measure the coverage of a JUnit testsuite. However I found two problems:

1. When instrumenting the code I get a lot of "WARN   visitEnd, No line number information found for ...  Perhaps you need to compile with debug=true?" type of warnings. The code is compiled with debug=true. I also found this blogpost (http://meera-subbarao.blogspot.com/2008/07/cobertura-instrument-warn-visitend-no.html) and putdebuglevel="vars,lines,source" in my build task, but it made no difference. What seems weird to me, is the fact that every warning seems to be related to an anonymous inner class... Does the instrumentation code have problems with anonymous inner classes or am I doing something wrong?

2. When I tried to generate the report, I got the following exception:

Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 2338 classes.
net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ":" ": "" at line 1322, column 31.
Was expecting one of:
    "[" ...
    ";" ...
    "," ...
    "=" ...

        at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10296)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10172)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(JavaParser.java:4380)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3828)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3997)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3947)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:2039)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1082)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:941)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:854)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:761)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:608)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:353)
        at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:137)
        at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:256)
        at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:339)
        at net.sourceforge.cobertura.javancss.Javancss.<init>(Javancss.java:419)
        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:102)
        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:139)
        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:224)
        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:194)
        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:164)
        at net.sourceforge.cobertura.reporting.xml.XMLReport.<init>(XMLReport.java:80)
        at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:107)
        at net.sourceforge.cobertura.reporting.Main.main(Main.java:174)
WARN   getAccumlatedCCNForSource, JavaNCSS got an error while parsing the java file ...
ParseException in STDIN
Last useful checkpoint: "...."
Encountered " ":" ": "" at line 1322, column 31.
Was expecting one of:
    "[" ...
    ";" ...
    "," ...
    "=" ...

At the indicated line in the source there is a code like this:

for (Foo i : bar) { ... }

Does the exception mean that the parser employed by cobertura doesn't support this construct? If this is the case, is is possible to generate a report without parsing the source code? I'm interested only the line numbers anyway and I'll use some custom code to generate the reports.

I'm using a rather old JDK (1.5.0_14) because this is a legacy codebase. I'll try to update to the latest JDK 5.0 (.21) later today and see if it makes a difference.

Best regards.



     

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Cobertura-devel mailing list
Cobertura-devel@...
https://lists.sourceforge.net/lists/listinfo/cobertura-devel

Re: Two cobertura questions

by Jim Showalter-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you using the very latest Cobertura JAR? It fixed various problems
with the parser used to generate reports.

----- Original Message -----
From: "Balazs Attila-Mihaly (Cd-MaN)" <x_at_y_or_z@...>
To: <cobertura-devel@...>
Sent: Thursday, October 08, 2009 12:01 AM
Subject: [Cobertura-devel] Two cobertura questions


> Hello everybody.
>
> I would like to use Cobertura to measure the coverage of a JUnit
> testsuite. However I found two problems:
>
> 1. When instrumenting the code I get a lot of "WARN   visitEnd, No
> line number information found for ...  Perhaps you need to compile
> with debug=true?" type of warnings. The code is compiled with
> debug=true. I also found this blogpost
> (http://meera-subbarao.blogspot.com/2008/07/cobertura-instrument-warn-visitend-no.html)
> and putdebuglevel="vars,lines,source" in my build task, but it made
> no difference. What seems weird to me, is the fact that every
> warning seems to be related to an anonymous inner class... Does the
> instrumentation code have problems with anonymous inner classes or
> am I doing something wrong?
>
> 2. When I tried to generate the report, I got the following
> exception:
>
> Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> Cobertura: Loaded information on 2338 classes.
> net.sourceforge.cobertura.javancss.parser.ParseException:
> Encountered " ":" ": "" at line 1322, column 31.
> Was expecting one of:
>    "[" ...
>    ";" ...
>    "," ...
>    "=" ...
>
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10296)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10172)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(JavaParser.java:4380)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.Statement(JavaParser.java:3828)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3997)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3947)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:2039)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1082)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:941)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:854)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:761)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:608)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser.java:353)
>        at
> net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:137)
>        at
> net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:256)
>        at
> net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:339)
>        at
> net.sourceforge.cobertura.javancss.Javancss.<init>(Javancss.java:419)
>        at
> net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:102)
>        at
> net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:139)
>        at
> net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:224)
>        at
> net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:194)
>        at
> net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:164)
>        at
> net.sourceforge.cobertura.reporting.xml.XMLReport.<init>(XMLReport.java:80)
>        at
> net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:107)
>        at
> net.sourceforge.cobertura.reporting.Main.main(Main.java:174)
> WARN   getAccumlatedCCNForSource, JavaNCSS got an error while
> parsing the java file ...
> ParseException in STDIN
> Last useful checkpoint: "...."
> Encountered " ":" ": "" at line 1322, column 31.
> Was expecting one of:
>    "[" ...
>    ";" ...
>    "," ...
>    "=" ...
>
> At the indicated line in the source there is a code like this:
>
> for (Foo i : bar) { ... }
>
> Does the exception mean that the parser employed by cobertura
> doesn't support this construct? If this is the case, is is possible
> to generate a report without parsing the source code? I'm interested
> only the line numbers anyway and I'll use some custom code to
> generate the reports.
>
> I'm using a rather old JDK (1.5.0_14) because this is a legacy
> codebase. I'll try to update to the latest JDK 5.0 (.21) later today
> and see if it makes a difference.
>
> Best regards.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market and
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Cobertura-devel mailing list
> Cobertura-devel@...
> https://lists.sourceforge.net/lists/listinfo/cobertura-devel 


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Cobertura-devel mailing list
Cobertura-devel@...
https://lists.sourceforge.net/lists/listinfo/cobertura-devel

Re: Two cobertura questions

by Balazs Attila-Mihaly (Cd-MaN) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using version 1.9.3, which seems to be the latest available from the site. I will try to build from source later today.



----- Original Message ----
From: Jim Showalter <jim@...>
To: Balazs Attila-Mihaly (Cd-MaN) <x_at_y_or_z@...>; cobertura-devel@...
Sent: Thursday, 8 October, 2009 10:05:00
Subject: Re: [Cobertura-devel] Two cobertura questions

Are you using the very latest Cobertura JAR? It fixed various problems with the parser used to generate reports.

----- Original Message ----- From: "Balazs Attila-Mihaly (Cd-MaN)" <x_at_y_or_z@...>
To: <cobertura-devel@...>
Sent: Thursday, October 08, 2009 12:01 AM
Subject: [Cobertura-devel] Two cobertura questions


> Hello everybody.
>
> I would like to use Cobertura to measure the coverage of a JUnit testsuite. However I found two problems:
>
> 1. When instrumenting the code I get a lot of "WARN   visitEnd, No line number information found for ...  Perhaps you need to compile with debug=true?" type of warnings. The code is compiled with debug=true. I also found this blogpost (http://meera-subbarao.blogspot.com/2008/07/cobertura-instrument-warn-visitend-no.html) and putdebuglevel="vars,lines,source" in my build task, but it made no difference. What seems weird to me, is the fact that every warning seems to be related to an anonymous inner class... Does the instrumentation code have problems with anonymous inner classes or am I doing something wrong?
>
> 2. When I tried to generate the report, I got the following exception:
>
> Cobertura 1.9.3 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
> Cobertura: Loaded information on 2338 classes.
> net.sourceforge.cobertura.javancss.parser.ParseException: Encountered " ":" ": "" at line 1322, column 31.
> Was expecting one of:
>    "[" ...
>    ";" ...
>    "," ...
>    "=" ...
>
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.generateParseException(JavaParser.java:10296)
>        at net.sourceforge.cobertura..javancss.parser.JavaParser.jj_consume_token(JavaParser.java:10172)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.ForStatement(JavaParser.java:4380)
>        at net.sourceforge.cobertura.javancss.parser..JavaParser.Statement(JavaParser.java:3828)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.BlockStatement(JavaParser.java:3997)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.Block(JavaParser.java:3947)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.MethodDeclaration(JavaParser.java:2039)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBodyDeclaration(JavaParser.java:1082)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassBody(JavaParser.java:941)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.UnmodifiedClassDeclaration(JavaParser.java:854)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.ClassDeclaration(JavaParser.java:761)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.TypeDeclaration(JavaParser.java:608)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.CompilationUnit(JavaParser..java:353)
>        at net.sourceforge.cobertura.javancss.parser.JavaParser.parse(JavaParser.java:137)
>        at net.sourceforge.cobertura.javancss.Javancss._measureSource(Javancss.java:256)
>        at net.sourceforge.cobertura.javancss.Javancss._measureRoot(Javancss.java:339)
>        at net.sourceforge.cobertura.javancss.Javancss.<init>(Javancss.java:419)
>        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSource(ComplexityCalculator.java:102)
>        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getAccumlatedCCNForSingleFile(ComplexityCalculator.java:139)
>        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForSourceFileNameInternal(ComplexityCalculator.java:224)
>        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForPackageInternal(ComplexityCalculator.java:194)
>        at net.sourceforge.cobertura.reporting.ComplexityCalculator.getCCNForProject(ComplexityCalculator.java:164)
>        at net.sourceforge.cobertura..reporting.xml.XMLReport.<init>(XMLReport.java:80)
>        at net.sourceforge.cobertura.reporting.Main.parseArguments(Main.java:107)
>        at net.sourceforge.cobertura.reporting.Main.main(Main.java:174)
> WARN   getAccumlatedCCNForSource, JavaNCSS got an error while parsing the java file ....
> ParseException in STDIN
> Last useful checkpoint: "...."
> Encountered " ":" ": "" at line 1322, column 31.
> Was expecting one of:
>    "[" ...
>    ";" ...
>    "," ...
>    "=" ...
>
> At the indicated line in the source there is a code like this:
>
> for (Foo i : bar) { ... }
>
> Does the exception mean that the parser employed by cobertura doesn't support this construct? If this is the case, is is possible to generate a report without parsing the source code? I'm interested only the line numbers anyway and I'll use some custom code to generate the reports.
>
> I'm using a rather old JDK (1.5.0_14) because this is a legacy codebase. I'll try to update to the latest JDK 5.0 (.21) later today and see if it makes a difference.
>
> Best regards.
>
>
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009.. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Cobertura-devel mailing list
> Cobertura-devel@...
> https://lists.sourceforge.net/lists/listinfo/cobertura-devel 


     


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Cobertura-devel mailing list
Cobertura-devel@...
https://lists.sourceforge.net/lists/listinfo/cobertura-devel