groovy.lang.MissingMethodException: No signature of method: static com.github.difflib.DiffUtils.generateUnifiedDiff() is applicable for argument types: (java.lang.String, java.lang.String, java.util.ArrayList, com.github.difflib.patch.Patch, java.lang.Integer) values: [Data.csv, Data.csv, ["ID","NAME","NAME","EMAIL" , "011","John","22","John@email.com" , ...], ...]
时间: 2023-07-19 22:20:25 浏览: 83
studio碰到问题:java.lang.UnsatisfiedLinkError解决办法
这个错误提示说明您还是没有正确地传递参数。具体来说,您需要将 `content1List` 和 `patch` 参数类型转换为 `java.util.List` 和 `com.github.difflib.patch.Patch` 类型,因为 `DiffUtils.generateUnifiedDiff()` 方法的参数类型分别为 `java.lang.String`、`java.lang.String`、`java.util.List<java.lang.String>`、`com.github.difflib.patch.Patch<java.lang.String>` 和 `int`。
您可以尝试修改代码如下:
```
import com.github.difflib.patch.Patch
def content1List = new ArrayList<String>(content1.tokenize("\n"))
Patch<String> patch = DiffUtils.diff(content1List, content2.tokenize("\n"))
def diff = DiffUtils.generateUnifiedDiff(csvFile1.name, csvFile2.name, content1List as List<String>, patch as Patch<String>, 1)
```
这样就可以将 `content1List` 和 `patch` 参数类型转换为 `java.util.List` 和 `com.github.difflib.patch.Patch` 类型,然后作为参数传递给 `DiffUtils.generateUnifiedDiff()` 方法了。
阅读全文