CodePhiliaX / fastexcel

easyexcel作者最新升级版本, 快速、简洁、解决大文件内存溢出的java处理Excel工具
Apache License 2.0
1.7k stars 116 forks source link

建议@EqualsAndHashCode添加 exclude 或 of 参数 排除循环引用对象 #97

Open fkong-bgl opened 6 days ago

fkong-bgl commented 6 days ago

在scala3中 会出现hashCode死循环 Scala2 升级scale3后出现 hashCoded导致的StackOverflowError

触发Bug的代码 class ExportData( field1: String, field2: String, description: Option[String] // 使用Option 导致hashCode死循环 ) { def getField1() = field1

def getField2() = field2

def getDescription(): Option[String] = description }

class SimpleTest {

val exportData = List( new ExportData("data1", "data2", Some("abc")),

)

@Test def test(): Unit = { EasyExcelFactory.write("out2.csv", classOf[ExportData]) .excelType(ExcelTypeEnum.CSV) .sheet("Sheet1") .doWrite(exportData.asJava) } }

提示的异常或者没有达到的效果 java.lang.StackOverflowError at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.excel.metadata.csv.CsvWorkbook.hashCode(CsvWorkbook.java:36) at com.alibaba.excel.metadata.csv.CsvSheet.hashCode(CsvSheet.java:60) at com.alibaba.

fkong-bgl commented 6 days ago

已提交 fix PR https://github.com/CodePhiliaX/easyexcel-plus/pull/99