Skip to content

[BUG] @Data compilation fails with "cannot find symbol" on JDK 24/25, works on JDK 21 #3967

Description

@ACANX

Describe the bug
After upgrading to JDK 24 or JDK 25, Maven compilation fails for classes annotated with Lombok’s @DaTa annotation, throwing a "cannot find symbol" error. The same project compiles successfully when using JDK 21.

To Reproduce

  1. Use a Java class with Lombok’s @Data annotation, for example:

    import lombok.Data;
    
     @Data
     public class EmailEntry {
     
         private EmailAccount sender;
     
         private EmailAccount to;
     
         private String name;
     
         private String subject;
     
         private List<String> tags;
     
         private String htmlContent;
     }
  2. Compile the project with Maven under JDK 24 or JDK 25.

  3. Observe the compilation error similar to:

[ERROR] /D:/Code/JavaCode/AModule/cf/cf-biz/src/main/java/com/amodule/cf/mail/aws/ses/AwsSes.java:[58,55] 找不到符号
  符号:   方法 getSender()
  位置: 类型为com.amodule.mail.aws.ses.model.EmailEntry的变量 entry
[ERROR] /D:/Code/JavaCode/AModule/cf/cf-biz/src/main/java/com/amodule/cf/mail/aws/ses/AwsSes.java:[60,68] 找不到符号
  符号:   方法 getTo()
  位置: 类型为com.amodule.mail.aws.ses.model.EmailEntry的变量 entry
[ERROR] /D:/Code/JavaCode/AModule/cf/cf-biz/src/main/java/com/amodule/cf/mail/aws/ses/AwsSes.java:[64,48] 找不到符号
  符号:   方法 getSubject()
  位置: 类型为com.amodule.mail.aws.ses.model.EmailEntry的变量 entry
[ERROR] /D:/Code/JavaCode/AModule/cf/cf-biz/src/main/java/com/amodule/cf/mail/aws/ses/AwsSes.java:[69,56] 找不到符号
  符号:   方法 getHtmlContent()
  位置: 类型为com.amodule.mail.aws.ses.model.EmailEntry的变量 entry

Expected behavior

The project should compile successfully with Lombok annotations under JDK 24/25, as it does under JDK 21.

Version info (please complete the following information):

  • Lombok Version: 1.18.40/1.18.42
  • Maven Version: 3.8.6
  • JDK Version: 24/25 (failing), 21 (working)
  • Operating System: Windows 11

Additional context

  • This issue may be related to changes in the JDK internal APIs or the way Lombok generates code for newer JDK versions.
  • Downgrading to JDK 21 resolves the issue, confirming the problem is specific to JDK 24/25.

Additional Information:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions