jcov template usage

José Cornado jose.cornado at gmail.com
Wed Apr 6 19:19:08 UTC 2016


thanks!


I think I can work with the custom filter suggestion. Another silly
question:

Do the stats reflect the new totals? For instance, are the total number of
lines restricted to the filtered methods?

Again, thanks!

On Wed, Apr 6, 2016 at 12:45 PM, Alexey Fedorchenko <
Alexey.Fedorchenko at oracle.com> wrote:

> Hello!
>
>   Thank you for using JCov.
>
> I was
> wondering how to use the template.xml lists.
>
> Are you trying to filter instrumentation? If you mean
> “include_list”/“exclude_list” options
> for Instr command, the effect will be the same as using multiple
> “include”/“exclude” options.
>
> Is there a way to tell jcov to instrument coverage for an specific method
> alone?
>
> We have a request for custom logic to exclude instrumentation points
> https://bugs.openjdk.java.net/browse/CODETOOLS-7901341
> If the goal is to receive coverage report for an specific method, you can
> instrument the class
> and filter the specific method with the repgen command option “filter”
> (report generation command
>  with custom filtering plugin class).
>
> For an example:
>
> public class CustomFilter implements FilterSpi {
>
>     class MyF implements MemberFilter {
>
>         /**
>          * Rejects classes which name contains "1"
>          */
>         public boolean accept(DataClass clazz) {
>             return clazz.getFullname().indexOf("1") < 0;
>         }
>
>         /**
>          * Accpept only those methods which names ends with a digit.
>          */
>         public boolean accept(DataClass dc, DataMethod dm) {
>             String name = dm.getName();
>             char last = name.charAt(name.length() - 1);
>             return Character.isDigit(last);
>         }
>
>         /**
>          * No fields accepted.
>          */
>         public boolean accept(DataClass dc, DataField df) {
>             return false;
>         }
>
>     }
>
>     public MemberFilter getFilter() {
>         return new MyF();
>     }
>
>
> }
>
>
> You can find some general instrumentation process description at
> https://wiki.openjdk.java.net/display/CodeTools/JCov+FAQ
>
>
> —Alexey
>
>
> On 06 Apr 2016, at 05:06, José Cornado <jose.cornado at gmail.com> wrote:
>
> Hello!
>
> I am trying to use jcov as a part of a tool (an ide plugin) and I was
> wondering how to use the template.xml lists.
>
> Is there a way to tell jcov to instrument coverage for an specific method
> alone?
>
> thanks in advance
>
> --
> José Cornado
>
> --
>
> home: http://www.efekctive.com
> blog:   http://blogging.efekctive.com
> ----------------------
>
> Everything has been said before, but since nobody listens we have to keep
> going back and beginning all over again.
>
> Andre Gide
>
>
>


-- 
José Cornado

--

home: http://www.efekctive.com
blog:   http://blogging.efekctive.com
----------------------

Everything has been said before, but since nobody listens we have to keep
going back and beginning all over again.

Andre Gide


More information about the jcov-dev mailing list