Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lombok.config ignored in 1.14.0 #2887

Closed
FlipWarthog opened this issue Jan 18, 2023 · 12 comments · Fixed by #3031 or #3071
Closed

lombok.config ignored in 1.14.0 #2887

FlipWarthog opened this issue Jan 18, 2023 · 12 comments · Fixed by #3031 or #3071

Comments

@FlipWarthog
Copy link

FlipWarthog commented Jan 18, 2023

After updating the extension to 1.14.0, my lombok.config file is being ignored, specifically the lombok.log.fieldName=LOG setting.

Environment
  • Operating System: Windows
  • JDK version: 14
  • Visual Studio Code version: 1.74.3
  • Java extension version: 1.14.0
Steps To Reproduce
  1. Extract attached project
  2. Running mvn clean package from the commandline succeeds
  3. Loading the project into vscode with the 1.14.0 extension shows the error

Sample reproducer:
vscode-java-issue.zip

Issue example:
vscode-java-issue

Current Result

vscode shows that LOG cannot be resolved to a variable, and log is not used.

Expected Result

lombok.config changes log to LOG so this error/warning combo should not be shown.

Additional Information

I did confirm that manually reverting back to 1.13.0 makes the issue go away.

@FlipWarthog
Copy link
Author

Lombok Configuration reference: https://projectlombok.org/features/configuration

@schophil
Copy link

I have got the same issue with the @CustomLog annotation.

Screenshot 2023-01-18 at 08 03 09

@vdkhvb
Copy link

vdkhvb commented Jan 18, 2023

Can confirm, I got these issues as well (CustomLog annotation fails & renaming of log field is not applied). It all boils down to not processing the lombok.config file. Simply downgrading the plugin fixes the issue, whilst playing with the flag for disabling lombok support or picking the lombok jar doesn't help.

@snjeza
Copy link
Contributor

snjeza commented Jan 18, 2023

This is an upstream lombok issue related to

Lombok can't load the ResourcePlugin class at https://github.com/projectlombok/lombok/blob/master/src/core/lombok/eclipse/EclipseAST.java#L191

@FlipWarthog Could you try Lombok 1.18.26?

"java.jdt.ls.vmargs": " -javaagent:<path_to_lombok-1.18.26.jar> <your_arguments>",

@FlipWarthog
Copy link
Author

@snjeza Trying the jar provided and setting the javaagent param results in the same issue after updating to 1.14.0 of the extension. Not sure what 1.18.26 of Lombok is since it looks like the latest snapshot is only 1.18.25 (Note: even trying that Edge release from Lombok I'm still seeing the issue).

And using any of these versions of Lombok with the 1.13.0 version of the extension shows it working properly, so I can't wrap my head around how it could be upstream?

@snjeza
Copy link
Contributor

snjeza commented Jan 19, 2023

@FlipWarthog https://github.com/snjeza/vscode-test/raw/master/lombok-1.18.26.jar is a patched lombok jar.
Could you try the following properties:

"java.jdt.ls.lombokSupport.enabled": false,
"java.jdt.ls.vmargs": " -javaagent:<path_to_lombok-1.18.26.jar> <your_arguments>",

lombok4

... so I can't wrap my head around how it could be upstream?

Eclipse JDT has been changed. The Eclipse ECJ plugin doesn't include the resources and runtime plugin - https://www.eclipse.org/eclipse/news/4.27/jdt.php#ecj-separated-from-core
Java LS >= 0.14.0 uses Eclipse 4.27.
It causes this issue with lombok. lombok-1.18.26 should fix it.

@FlipWarthog
Copy link
Author

@snjeza Ahh, that worked and thank you for the clarification! Explicitly disabling loading from the project classpath was key, in addition to setting the javaagent to point to the patched version. Thanks, again.

@snjeza
Copy link
Contributor

snjeza commented Jan 19, 2023

@FlipWarthog I have created projectlombok/lombok#3332

@testforstephen testforstephen linked a pull request Mar 30, 2023 that will close this issue
@testforstephen testforstephen added this to the Early April 2023 milestone Mar 30, 2023
@rgrunber rgrunber removed this from the Early April 2023 milestone Apr 13, 2023
@rgrunber
Copy link
Member

Re-opening as we've reverted the change that fixed this due to potentially more serious issues with the lombok edge release. Hopefully we can fix these in subsequent release.

@rgrunber rgrunber reopened this Apr 13, 2023
@rgrunber rgrunber added this to the End April 2023 milestone Apr 13, 2023
snjeza added a commit to snjeza/eclipse.jdt.ls that referenced this issue Apr 15, 2023
@snjeza
Copy link
Contributor

snjeza commented Apr 15, 2023

This issue hasn't been fixed properly.

Steps to reproduce:

You will get LOG cannot be resolved

A workaround

  • open Test.java
  • call Developer: Reload Window

@jcolladosp
Copy link

any update in this issue?

@Eskibear
Copy link
Contributor

yes, I think. A fix in upstream has been released, see projectlombok/lombok#3406 (comment)

Next step would be adopting #3031 again and give it a try on the coming pre-release. @jcolladosp you can keep an eye on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants