Thanks Marc for the explanation. That's bad news for me, though.
For the constructor, actually I didn't define such a constructor; Jacoco 
'identifies' or 'defines' it...
For the static one, it's not even a method. It's only an initializer of a 
private member...
So, is there an approach to prevent jacoco from thinking them as methods, 
so that they won't be included in the execution report?
Thanks.
--huafeng

On Wednesday, August 28, 2019 at 8:02:30 PM UTC+8, Marc R. Hoffmann wrote:
>
> Hi Huafeng,
>
> both are executable code that at least for the static initializer also 
> exist in your source code and therefore shown by JaCoCo.
>
> There is no option to exclude specific methods from JaCoCo.
>
> Regards,
> -marc
>
>
> On 28. Aug 2019, at 10:55, [email protected] <javascript:> wrote:
>
> Hi,
> My class looks like
>
> 1 public class XXXController {
> 2
> 3     private static Logger logger = getLogger(XXX.class);
> ...
>
> I the report jacoco generated, it identifies two methods that don't 
> actually exist.
> The first is "XXXController()", located at line 1. This is obviously the 
> constructor method, which I didn't define, but Jacoco just treat the class 
> as the constructor method.
> The second is "static {...}", located at line 3.
>
> Such behavior affects the coverage number in the report... how can I 
> prevent Jacoco to identify such non-existent methods?
> Thanks.
> --huafeng
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jacoco/09478e63-411a-40a8-84a4-91197e679131%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jacoco/09478e63-411a-40a8-84a4-91197e679131%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/cab32647-17f0-4a16-8946-673e1f16fd23%40googlegroups.com.

Reply via email to