-
Notifications
You must be signed in to change notification settings - Fork 442
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
Support for val in lombok #2983
Comments
Might be an Eclipse JDT bug upstream. Can you check if it works in a lombokified Eclipse IDE? |
@fbricon I followed those instructions and it works in Eclipse. Hovering over the created variable shows the correct type. |
@FunctionDJ thanks for checking. So it must be a jdt.ls issue then. @snjeza can you please take a look? |
@FunctionDJ does completion work too in Eclipse, with the expected methods from the inferred type? |
Also |
@FunctionDJ Which version of Eclipse have you tested? |
This is an upstream lombok issue. See
@FunctionDJ Could you check lombok-1.18.27
|
@snjeza I did those changes and it seems to have fixed |
@FunctionDJ Could you try to clean the workspace directory? |
@snjeza Unfortunately, same result. I also checked
|
@FunctionDJ Could you show your user and workspace settings.json? |
Sure. I've limited the entries to the ones that contain "java" somewhere. User {
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -javaagent:\"c:\\Users\\some-user\\.vscode\\extensions\\gabrielbb.vscode-lombok-1.0.1\\server\\lombok.jar\"",
"java.configuration.runtimes": [
{
"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.3.7-hotspot",
"name": "JavaSE-17"
}
],
"java.format.settings.url": "C:/local/foo.xml",
"java.autobuild.enabled": true,
"boot-java.live-information.fetch-data.max-retries": 20,
"boot-java.live-information.fetch-data.retry-delay-in-seconds": 5,
"java.debug.settings.showLogicalStructure": true,
"java.debug.settings.showToString": true,
"java.debug.settings.showQualifiedNames": false,
"java.debug.settings.showStaticVariables": false,
"java.debug.settings.showHex": false,
"boot-java.rewrite.reconcile": true,
"[java]": {
"editor.defaultFormatter": "redhat.java"
},
"java.inlayHints.parameterNames.enabled": "none",
"java.sources.organizeImports.starThreshold": 3,
"java.sources.organizeImports.staticStarThreshold": 3,
} Workspace {
"java.dependency.packagePresentation": "hierarchical",
"java.jdt.ls.lombokSupport.enabled": false,
"java.jdt.ls.vmargs": "-javaagent:C:\\Users\\some-user\\Downloads\\lombok-1.18.27.jar -Xlog:jni+resolve=off",
"java.configuration.updateBuildConfiguration": "automatic",
"debug.console.wordWrap": false,
"java.compile.nullAnalysis.mode": "automatic",
} |
@FunctionDJ I have tested with your settings. It works fine. Could you show an example reproducing the error? |
@FunctionDJ Could you remove
from your settings.java as well as the gabrielbb.vscode-lombok extension? This extension is deprecated. |
Just in case anybody wants a third data point here: I had the same problem as @FunctionDJ. @snjeza’s proposed workaround of disabling LS Lombok support and adding 1.18.27 jar as agent works for me. |
@snjeza Indeed it works with a fresh Spring Boot project (both Maven, both Java 17, almost the same Spring version). |
I've spent a lot of time and work getting to a minimal reproduction state.
There are a couple of things that will magically fix this, like removing the |
@FunctionDJ I can reproduce it in Eclipse 4.27. Which version of Eclipse are you using? A related issue - projectlombok/lombok#3332 |
Since version 1.18.22 lombok uses the Java native version of |
@snjeza I used 4.26.0 but i've installed 4.27.0 and made sure to add the same Adoptium JDK as i use in VSCode and it seems to ignore the lombok import for some reason. |
@Rawi01 Yeah it came up by coincidence because we want to turn more than 3 imports from the same package into a wildcard import. That's how i initially ran into this issue because |
@FunctionDJ I used 4.26.0 but i've installed 4.27.0 and made sure to add the same Adoptium JDK as i use in VSCode and it seems to ignore the lombok import for some reason. It is an upstream lombok issue. See #2983 (comment) |
Fixed upstream (edge release is working for me): projectlombok/lombok#3332 |
Lombok's
val
doesn't seem to be supported. The type of the variable isn't inferred and becomesObject
when referenced.Environment
Steps To Reproduce
lombok.val
Current Result
Expected Result
The type is properly recognized. Similar behavior to
final var
.The text was updated successfully, but these errors were encountered: