[alibaba/easyexcel]com.alibaba.easyexcel.test.demo.write.WriteTest 写法3 Required type: AutoClosable 错误

2024-04-30 337 views
1
    try (ExcelWriter excelWriter = EasyExcel.write(fileName, DemoData.class).build()) {
      // some code
     }

编译器提示,Required type: AutoClosable; Provided: ExcelWriter 问题如何解决。感觉代码完全错误,但示例确实这么写的。奇怪。

回答

1

请提供使用对应的JDK版本,方便复现

3

java version "17.0.6" 2023-01-17 LTS Java(TM) SE Runtime Environment (build 17.0.6+9-LTS-190) Java HotSpot(TM) 64-Bit Server VM (build 17.0.6+9-LTS-190, mixed mode, sharing)

9

easyexcel 3.0.5 不适用上例。打扰了lonecloud