alibaba / easyexcel

快速、简洁、解决大文件内存溢出的java处理Excel工具
https://easyexcel.opensource.alibaba.com
Apache License 2.0
32.02k stars 7.49k forks source link

实体类字段命名【A-Z】导致读不到数据的问题 #3978

Open zzy0759 opened 2 weeks ago

zzy0759 commented 2 weeks ago

触发场景描述

一个实体类的字段,按照大写字母的方式去命名,分别对应表格的列ABCD等。会导致这些字段读不到表格对应的属性值。 经测试,发现只有单个大写字母【A-Z】的字段命名,会出现如上问题。(从表格的AA列开始就可正常读取)

触发Bug的代码

@Data
@ToString
public class Var {
    @ExcelProperty(index = 0)
    private String A;
    @ExcelProperty(index = 1)
    private String B;
    @ExcelProperty(index = 2)
    private String C;
    @ExcelProperty(index = 3)
    private String D;
    @ExcelProperty(index = 4)
    private String E;
    @ExcelProperty(index = 5)
    private String F;
    @ExcelProperty(index = 6)
    private String G;
    @ExcelProperty(index = 7)
    private String H;
    @ExcelProperty(index = 8)
    private String I;
...
//以下命名是可以正常读取的
    @ExcelProperty(index = 26)
    private String AA;
    @ExcelProperty(index = 27)
    private String AB;
    @ExcelProperty(index = 28)
    private String AC;
    @ExcelProperty(index = 29)
    private String AD;
    @ExcelProperty(index = 30)
    private String AE;
}

提示的异常或者没有达到的效果

这些列读不到数据。如果换成小写字母或者长一点的字段名就正常。

psxjoy commented 2 weeks ago

Please ensure class attributes follow the camelCase naming convention; otherwise, cglib might not correctly recognize the attribute names.

请使用规范的驼峰命名类属性,否则cglib可能无法识别正确的类属性名称。

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: zzy0759 @.> 发送时间: Thursday, September 5, 2024 4:37:12 PM 收件人: alibaba/easyexcel @.> 抄送: Subscribed @.***> 主题: [alibaba/easyexcel] 实体类字段命名【A-Z】导致读不到数据的问题 (Issue #3978)

触发场景描述

一个实体类的字段,按照大写字母的方式去命名,分别对应表格的列ABCD等。会导致这些字段读不到表格对应的属性值。 经测试,发现只有单个大写字母【A-Z】的字段命名,会出现如上问题。(从表格的AA列开始就可正常读取)

触发Bug的代码

@Data @ToString public class Var { @ExcelProperty(index = 0) private String A; @ExcelProperty(index = 1) private String B; @ExcelProperty(index = 2) private String C; @ExcelProperty(index = 3) private String D; @ExcelProperty(index = 4) private String E; @ExcelProperty(index = 5) private String F; @ExcelProperty(index = 6) private String G; @ExcelProperty(index = 7) private String H; @ExcelProperty(index = 8) private String I; ... //以下命名是可以正常读取的 @ExcelProperty(index = 26) private String AA; @ExcelProperty(index = 27) private String AB; @ExcelProperty(index = 28) private String AC; @ExcelProperty(index = 29) private String AD; @ExcelProperty(index = 30) private String AE; }

提示的异常或者没有达到的效果

这些列读不到数据。如果换成小写字母或者长一点的字段名就正常。

― Reply to this email directly, view it on GitHubhttps://github.com/alibaba/easyexcel/issues/3978, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACRXFDSAO535VWMTZEHELALZVAJ3RAVCNFSM6AAAAABNV63SUCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYDOMJUGYZDQMI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

psxjoy commented 1 week ago

This issue has been completed, I will close this issue.