2

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;
}
leon
  • 550
  • 6
  • 14
  • Can you share a code snippet? Are other lombok annotations set for this class? I use @Data(staticConstructor="of") in many places, Intellij does not report a syntax error for me. So, I think the context in which you are using the annotation might be the reason for the error shown. – Bertolt Mar 30 '23 at 18:59
  • Actually, It worked before, and it suddenly doesn't work, I even revert the changes. – leon Mar 30 '23 at 19:05
  • Did you check, if intellij throws any error? see https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files how to locate the logfiles. BTW, this question offers lots of suggestions on how to reset strange intellij errors: https://stackoverflow.com/questions/30615067/intellij-idea-maven-cannot-reconnect-error – Bertolt Mar 30 '23 at 19:16
  • 1
    I'm having the same issue with `@Value(staticConstructor = "of")` after updating to IntelliJ IDEA 2023.1. Using `@RequiredArgsConstructor(staticName = "of")` indeed "fixes" the issue, but I don't want to change it. – p.streef Mar 31 '23 at 08:20
  • 1
    For now I rolled back to 2022.3.3 and submitted a bugreport to jetbrains – p.streef Mar 31 '23 at 08:29
  • @Bertolt I did't check Intellij Logs, I don't know how to identify the syntax errors from these logs. – leon Mar 31 '23 at 18:46

1 Answers1

0

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;
}
leon
  • 550
  • 6
  • 14