Lombok @Data(staticConstructor="of") can generated code and build successfully and run my application, but Intellij reports syntax error on the method

It seems the index is not working fine. BTW, sharing the Intellij version here:

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

I've tried

  • Invalidate & Clear Cache & Restart
  • Delete .gradle
  • Delete /build /.gradle /.idea in my project folder

Neither of these helps.

Regarding the code, I can only provide a sample:

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

There are 1 best solutions below

0
leon On

I just fixed this by adding @RequiredArgsConstructor(staticName = "of")

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