Eclipse [EclEmma] 中的覆盖排除不起作用?

Coverage exclusion in Eclipse [EclEmma] is not working?

根据 on Whosebug and EclEmma's documentation,将 类 排除在覆盖范围之外应该是很有可能的。然而,虽然 "includes" 字段与描述的一样有效,但 "excludes" 字段却没有。

分别采用以下项目层次结构和覆盖率运行时设置:

但是,在运行覆盖操作之后,排除设置不起作用:

可以看出,被排除的包仍然包含在整体覆盖测试中。另外,如果你在"includes"中标记'*',在"excludes,"中标记一个包,它仍然不被排除。

根据this issue and Godlin's answer

Unfortunately currently EclEmma does not support exclusions from the report as stated in [issue]

然而,这个问题已经存在一年多了。 我在问我是不是做错了什么,或者这个问题是否仍然存在?如果这两个字段没有按预期工作,那么包含它们有什么意义?

版本:

Eclipse: Oxygen Release (4.7.0)

我认为对这些字段目前的工作方式存在误解,因为

However, while the "includes" field works just as described, the "excludes" field does not.

这个关于 "includes" 字段的陈述是不正确的,甚至在您的屏幕截图中也显示了 - 虽然仅包含 audio.*linguistics.*,但报告中还有其他包。

原因如下:这些字段大约 "Coverage Runtime" 并且对应于各自的 options of JaCoCo agent - they allow to specify classes whose bytecode will be modified, they do not include/exclude classes from generation of report. Classes whose bytecode wasn't modified will be presented in report with "0%". Such specification is useful for the rare cases when bytecode modification interferes with code under test as stated in cited by you documentation:

For technical reasons it might be necessary to exclude certain classes from code coverage analysis. The following options configure the coverage agent to exclude certain classes from analysis. Except for performance optimization or technical corner cases these options are normally not required.

和下面几行:

Warning: ... Excluded classes will still show as not covered.

所以是的 - 仍然没有排除报告。

However, this problem is well over a year old.

Eclipse EclEmma 项目是开源的,所以请随意实现此功能并回馈。