0

I have added a filter via annotation to exclude a method from jacoco coverage as mentioned here.

But when I see the jacoco html report for coverage I see the filtered method being shown in red as not covered. Please check the attached screenshot. Is this expected?

enter image description here

Annotation code looks like below

package com.spotnana.common;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;


@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ExcludeFromJacocoGeneratedReport {}

Jacoco Version - 0.8.8

tuk
  • 5,941
  • 14
  • 79
  • 162

1 Answers1

0

This has been answered in jacoco mailing list.

Ok. In this case what you see is the code of the lambda body. Technically the compiler creates a method for it which is not excluded. I’m afraid this is a limitation of the @Generated annotation.

get() method is excluded. But compiler internally created a method for lambda which is shown in red in the class level report. This seems to be a limitation of the jacoco @Generated annotation.

tuk
  • 5,941
  • 14
  • 79
  • 162