How to use filter for getter and setter?

583 views
Skip to first unread message

Anonymous

unread,
Aug 31, 2018, 7:25:29 AM8/31/18
to JaCoCo and EclEmma Users
Hi everybody,

I'm wondering how I have to use the filter mentioned on this page https://github.com/jacoco/jacoco/issues/678 to exclude getters and setters?

I work whit gradle and maven in my projects, but after two hour of googleing I didn't find a good answer - so I post here now.

Genereally it would be great if we would have examples how to use all existing filters.

Thanks in advance!

Regards,
Anon

Evgeny Mandrikov

unread,
Aug 31, 2018, 8:48:24 AM8/31/18
to JaCoCo and EclEmma Users
Hi,

This random ticket that you mention is not a documentation! And its first message doesn't contain any valid/correct information.

Up-to-date documentation always been and still here - https://www.jacoco.org/jacoco/trunk/doc/
This official documentation doesn't mention, nor provides example of filtering handwritten getters and setters, because there is simply no and never been such feature.
The only configurable filter described in documentation - is exclusion of whole classes.

Changelog (https://www.jacoco.org/jacoco/trunk/doc/changes.html) describes which artificial constructions generated by compilers (not handwritten) are filtered unconditionally (do not require any configuration beside usage of correct JaCoCo version).
You can find more details about such constructions in associated implementation tickets, you can also watch presentation "Bytecode Pattern Matching" ( https://www.eclemma.org/research/index.html ) that describes various such artifacts and why they should be filtered, and you can read https://stackoverflow.com/questions/42642840/why-is-jacoco-not-covering-my-string-switch-statements/42680333#42680333 which describes "switch on String" in particular.

As you also can see from changelog, there is only one case when automatically generated non-handwritten getters and setters are automatically filtered - when they are marked with annotation "Generated" by tools that automatically generate them (such as Lombok or Immutables).

Hope this clarifies.


Regards,
Evgeny
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages