redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 442 forks source link

IntelliCode and compilation failure due to Lombok configuration not detected since v1.12.0 #2962

Open Bokoblin opened 1 year ago

Bokoblin commented 1 year ago

Hi,

We have a professional maven Spring Boot project with Lombok annotations that we are usually developing on IntelliJ IDEA Ultimate, and for which we have no issues. Some of our new team members would preferably use VSCode to work on this project. For this purpose, I have tried playing with VSCode the past week.

I downloaded all mandatory extension and went for cloning the repository directly with VSCode so that there would be no potential clashes with my folder with intelliJ configuration. At the end of the importing, I'm stuck with VSCode IntelliCode detecting 3K+ problems due to Lombok annotations not recognized, while "mvn compile" work fine. I have spent the few last days trying different solutions looking at official documents, GitHub ticket and stackoverflow similar issues, from verifying that mandatory extensions were installed, resetting project after extension install, trying alternative extensions, explicitly mentioning lombok version instead of inheriting... to no avail.

A few minutes ago, though I tried downgrading "Language Support for Java(TM) by Red Hat" to 1.8.0 and something changed: I noticed this new bubble notification:

image

Once I clicked on it and reloaded the project, the errors start disappearing for the current file, and other files when clicking on errors individually. Once noticing that, I went back to 1.15.0 and the errors re-appeared.

Then, I went back one version each time to identify the first version with the problem:

Thus, I strongly think there was a regression in 1.12.0 making that lombok cease working for a setup similar to mine or for the other extensions, on a given version, I have

Environment

All extensions:

Steps To Reproduce
  1. Clone repository
  2. Watch the importing and auto compilation
Current Result

lombok annotations and related code not recognised, thus also failing compilation

The @CustomLog annotation is not configured; please set lombok.log.custom.declaration in lombok.config.
log cannot be resolved
The method userId() is undefined for the type XXX.YYY (it's a @Getter)
...
Expected Result

No IntelliCode problem detected

Additional Informations

Maven:

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

Lombok.config

lombok.data.flagUsage=warning
lombok.accessors.fluent=true

lombok.log.custom.declaration=com.xxx.YYY com.xxx.YYY.forEnclosingClass()

settings.json

{
    "java.compile.nullAnalysis.mode": "automatic"
}

Note:

snjeza commented 1 year ago

This issue is an upstream lombok issue. @Bokoblin You may want to take a look at

Bokoblin commented 1 year ago

Hi @snjeza

Seems like the workaround works, thanks.\ Hopefully, https://github.com/projectlombok/lombok/pull/3347 will be merged soon for a potential 1.18.28 release