gpt4 book ai didi

java - cobertura maven 插件是否不适用于接口(interface)中的 java8 默认方法声明?

转载 作者:行者123 更新时间:2023-11-30 02:54:10 25 4
gpt4 key购买 nike

我已经使用 java8 默认方法声明声明了我的接口(interface):

public interface MyInterface {

default String myMethod(String str) {
//IMPLEMENTATION
}
}

接下来,我执行了maven目标:

mvn cobertura:cobertura

日志显示错误,因为 cobertura 不支持 java8 默认方法声明:

[INFO] Executed tasks
[INFO]
[INFO] <<< cobertura-maven-plugin:2.7:cobertura (default-cli) < [cobertura]test @ extractor <<<
[INFO]
[INFO] --- cobertura-maven-plugin:2.7:cobertura (default-cli) @ extractor ---
[INFO] Cobertura 2.1.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
[INFO] Cobertura: Loaded information on 134 classes.
[WARN] JavaNCSS got an error while parsing the java file <PATH_TO_MY_INTERFACE>\MyInterface.java
ParseException in STDIN
Last useful checkpoint: "path.to.my.class.MyInterface"
Encountered " "default" "default "" at line 10, column 9.
Was expecting one of:
"abstract" ...
"boolean" ...
"byte" ...
"char" ...
"class" ...
"double" ...
"enum" ...
"final" ...
"float" ...
"int" ...
"interface" ...
"long" ...
"native" ...
"private" ...
"protected" ...
"public" ...
"short" ...
"static" ...
"strictfp" ...
"synchronized" ...
"transient" ...
"void" ...
"volatile" ...
<IDENTIFIER> ...
"}" ...
";" ...
"@" ...
"<" ...

我该如何修复它?

最佳答案

我已更改为 JaCoCo maven 配置并且它有效。

JaCoCo Unit Tests + Reports

关于java - cobertura maven 插件是否不适用于接口(interface)中的 java8 默认方法声明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37751684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com