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] 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] > <mailto:[email protected]>. > 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/4E40ABBE-287E-4038-869C-119117FA8038%40mountainminds.com.
