You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IntelliJ识别Lombok @Data(staticConstructor="of")语法错误求助

Lombok @Data(staticConstructor="of") 代码可正常构建运行,但IntelliJ IDEA提示语法错误

使用Lombok的@Data(staticConstructor="of")注解后,代码能正常生成、构建并运行,但IntelliJ IDEA却提示该静态构造方法存在语法错误,推测是IDE索引功能异常。

IntelliJ IDEA版本信息

IntelliJ IDEA 2023.1 (Community Edition)
Build #IC-231.8109.175, built on March 28, 2023
Runtime version: 17.0.6+10-b829.5 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.6
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true

Kotlin: 231-1.8.20-IJ8109.175

已尝试的解决操作

  • 执行Invalidate & Clear Cache & Restart
  • 删除全局.gradle目录
  • 删除项目下的/build、.gradle、.idea目录

以上操作均未解决问题。

示例代码

@Data(staticConstructor = "of")
@ApiModel
public class Student {
    private final String id;
    private final StudentDetails details;
}

内容的提问来源于stack exchange,提问作者leon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 11:33:26