Skip to content

Symbols not getting resolved for lombok on vs code #3909

Description

@VincentLee-EN

My "Language support for Java ™ for Visual Studio Code" is v1.38.0, Symbols not getting resolved for lombok on vs code,but it can still compile and run

  1. when I use @slf4j,here comes errors:
    Image

  2. when I use @DaTa, the same situation happens
    Image

Activity

  1. snjeza commented on Jan 2, 2025

    @snjeza
    Collaborator

    @VincentLee-EN Could you attach a project example reproducing the error?

  2. VincentLee-EN commented on Jan 3, 2025

    @VincentLee-EN
    Author
  3. VincentLee-EN commented on Jan 3, 2025

    @VincentLee-EN
    Author

    Is it because I'm using Java 17 that the plugin doesn't support it very well yet?

  4. snjeza commented on Jan 3, 2025

    @snjeza
    Collaborator

    How?

    You can try Paste, drop or click to add files

    Is it because I'm using Java 17 that the plugin doesn't support it very well yet?

    You need Java 23 to use javac - "java.jdt.ls.javac.enabled": "on",

  5. VincentLee-EN commented on Jan 3, 2025

    @VincentLee-EN
    Author

    How?

    You can try Paste, drop or click to add files

    Is it because I'm using Java 17 that the plugin doesn't support it very well yet?

    You need Java 23 to use javac - "java.jdt.ls.javac.enabled": "on",

    My project uses Java17,is it a good idea to upgrade it to Java23?
    Or if there is any better solution to user javac while Java version is 17?

  6. VincentLee-EN commented on Jan 3, 2025

    @VincentLee-EN
    Author

    How?

    You can try Paste, drop or click to add files

    Is it because I'm using Java 17 that the plugin doesn't support it very well yet?

    You need Java 23 to use javac - "java.jdt.ls.javac.enabled": "on",

    My project uses Java17,is it a good idea to upgrade it to Java23? Or if there is any better solution to user javac while Java version is 17?

    here is my settings.json for java after I installed java23, but it didn't work, is the config is wrong?
    "java.jdt.ls.java.home": "/home/vincent/tools/java/jdk-23.0.1",
    "java.jdt.ls.javac.enabled": "on",
    "java.configuration.runtimes": [
    {
    "name": "JavaSE-17",
    "path": "/home/vincent/tools/java/jdk-17.0.12",
    "default": true
    },
    {
    "name": "JavaSE-23",
    "path": "/home/vincent/tools/java/jdk-23.0.1",
    }
    ],

  7. snjeza commented on Jan 3, 2025

    @snjeza
    Collaborator

    My project uses Java17

    Your project can use Java >= 1.8

  8. snjeza commented on Jan 3, 2025

    @snjeza
    Collaborator

    here is my settings.json for java after I installed java23, but it didn't work, is the config is wrong?

    Could you try the following:

    • install VS Code Pre-Release
    • add <your_project>/.settings//org.eclipse.jdt.apt.core.prefs with the following contents
    eclipse.preferences.version=1
    org.eclipse.jdt.apt.aptEnabled=true
    org.eclipse.jdt.apt.genSrcDir=.apt_generated
    org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
    org.eclipse.jdt.apt.reconcileEnabled=true
    
    • Open the command palette (F1)
    • select Java: Clean the Java Language Server Workspace
    • select Restart and delete from the confirmation prompt
  9. viswatejan commented on Jan 8, 2025

    @viswatejan

    here is my settings.json for java after I installed java23, but it didn't work, is the config is wrong?

    Could you try the following:

    • install VS Code Pre-Release
    • add <your_project>/.settings//org.eclipse.jdt.apt.core.prefs with the following contents
    eclipse.preferences.version=1
    org.eclipse.jdt.apt.aptEnabled=true
    org.eclipse.jdt.apt.genSrcDir=.apt_generated
    org.eclipse.jdt.apt.genTestSrcDir=.apt_generated_tests
    org.eclipse.jdt.apt.reconcileEnabled=true
    
    • Open the command palette (F1)
    • select Java: Clean the Java Language Server Workspace
    • select Restart and delete from the confirmation prompt

    I followed these steps, and it did not resolve the issue for me.

    I also reported this issue when javac experimental support is release and since then I switched back to ECJ.

  10. snjeza commented on Jan 8, 2025

    @snjeza
    Collaborator

    @VincentLee-EN I can't reproduce the issue.
    Please attach a project example reproducing the issue.

  11. VincentLee-EN commented on Jan 9, 2025

    @VincentLee-EN
    Author

    @VincentLee-EN I can't reproduce the issue. Please attach a project example reproducing the issue.

    I don't know if this will work properly, since it is impossible to be completely consistent for the environment and configuration between you and me

  12. viswatejan commented on Feb 4, 2025

    @viswatejan

    demo.zip

    @snjeza, you can try with this sample project. Lombok working fine with ECJ but failing when using Javac as the compiler(using JDK 23 for the language server).

    I see the following errors in the Language Support for Java Output window:

     [Error - 4:55:33 PM] Feb 4, 2025, 4:55:33 PM Error in calling delegate command handler
    java.lang.AbstractMethodError: Receiver class lombok.javac.Javac$JavadocOps_8$1 does not define or inherit an implementation of the resolved method 'abstract com.sun.tools.javac.util.JCDiagnostic$DiagnosticPosition getPos()' of interface com.sun.tools.javac.parser.Tokens$Comment.
    java.lang.RuntimeException: java.lang.AbstractMethodError: Receiver class lombok.javac.Javac$JavadocOps_8$1 does not define or inherit an implementation of the resolved method 'abstract com.sun.tools.javac.util.JCDiagnostic$DiagnosticPosition getPos()' of interface com.sun.tools.javac.parser.Tokens$Comment.
    	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.parse(JavacCompilationUnitResolver.java:844)
    	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.toCompilationUnit(JavacCompilationUnitResolver.java:545)
    	at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTCached(ASTParser.java:1392)
    	at org.eclipse.jdt.core.dom.ASTParser.lambda$1(ASTParser.java:1271)
    	at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5708)
    	at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1271)
    	at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:915)
    	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:175)
    	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:250)
    	at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:127)
    	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:569)
    	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:292)
    	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:278)
    	at org.eclipse.jdt.internal.core.JavaElement.exists(JavaElement.java:195)
    	at org.eclipse.jdt.internal.core.CompilationUnit.findPrimaryType(CompilationUnit.java:716)
    	at com.microsoft.jdtls.ext.core.PackageCommand.getChildrenForPackage(PackageCommand.java:429)
    	at com.microsoft.jdtls.ext.core.PackageCommand.getPackageChildren(PackageCommand.java:408)
    	at com.microsoft.jdtls.ext.core.PackageCommand.getChildren(PackageCommand.java:110)
    	at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:31)
    	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
    	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
    	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:615)
    	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
    	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:690)
    	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:527)
    	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
    	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1460)
    	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2036)
    	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:189)
    Caused by: java.lang.AbstractMethodError: Receiver class lombok.javac.Javac$JavadocOps_8$1 does not define or inherit an implementation of the resolved method 'abstract com.sun.tools.javac.util.JCDiagnostic$DiagnosticPosition getPos()' of interface com.sun.tools.javac.parser.Tokens$Comment.
    	at org.eclipse.jdt.core.dom.JavadocConverter.<init>(JavadocConverter.java:103)
    	at org.eclipse.jdt.core.dom.JavacConverter.convert(JavacConverter.java:3473)
    	at org.eclipse.jdt.core.dom.JavacConverter.setJavadocForNode(JavacConverter.java:1285)
    	at org.eclipse.jdt.core.dom.JavacConverter.commonSettings(JavacConverter.java:495)
    	at org.eclipse.jdt.core.dom.JavacConverter.commonSettings(JavacConverter.java:457)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertMethodDecl(JavacConverter.java:926)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertBodyDeclaration(JavacConverter.java:826)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertClassDecl(JavacConverter.java:678)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertClassDecl(JavacConverter.java:598)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertBodyDeclaration(JavacConverter.java:829)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertClassDecl(JavacConverter.java:678)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertClassDecl(JavacConverter.java:598)
    	at org.eclipse.jdt.core.dom.JavacConverter.convertBodyDeclaration(JavacConverter.java:829)
    	at org.eclipse.jdt.core.dom.JavacConverter.lambda$populateCompilationUnit$4(JavacConverter.java:200)
    	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
    	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
    	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
    	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
    	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
    	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
    	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:636)
    	at org.eclipse.jdt.core.dom.JavacConverter.populateCompilationUnit(JavacConverter.java:202)
    	at org.eclipse.jdt.core.dom.JavacCompilationUnitResolver.parse(JavacCompilationUnitResolver.java:748)
    	... 29 more
    
  13. self-assigned this
    on Feb 5, 2025
  14. viswatejan commented on Feb 7, 2025

    @viswatejan

    @snjeza, did this help you to reproduce the issue?

  15. snjeza commented on Feb 7, 2025

    @snjeza
    Collaborator

    did this help you to reproduce the issue?

    Yes, I was able to reproduce the issue. I'm working on it.

  16. 5 remaining items

  17. viswatejan commented on Apr 23, 2025

    @viswatejan

    @snjeza, I see lombok released 1.18.38 with a fix and you made necessary changes in the jdtls. May I know in which version of VS Code this issue will be resolved with the javac enabled?

  18. snjeza commented on Apr 23, 2025

    @snjeza
    Collaborator

    @viswatejan You can try VS Code 1.41.1 or pre-release.
    You need to set

    "java.jdt.ls.lombokSupport.enabled": false
    
  19. snjeza commented on Apr 23, 2025

    @snjeza
    Collaborator

    @viswatejan You have to start VS Code with Java 24. See #4029 (comment)

  20. viswatejan commented on Apr 28, 2025

    @viswatejan

    @snjeza, I followed the instructions but now the demo app is failing with the following issue

    INFO: -<- Done loading .javaASTValidators extension point -<-
    [Error - 12:17:47 PM] Apr 28, 2025, 12:17:47 PM compilation failed
    java.lang.ExceptionInInitializerError
    java.lang.RuntimeException: java.lang.ExceptionInInitializerError
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:168)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.generate(JavacTaskImpl.java:445)
    	at org.eclipse.jdt.internal.javac.JavacCompiler.compile(JavacCompiler.java:215)
    	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:442)
    	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:250)
    	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:373)
    	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:118)
    	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:311)
    	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:217)
    	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
    	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
    	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
    	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
    	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
    	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
    	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
    	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
    	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
    	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
    	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
    Caused by: java.lang.ExceptionInInitializerError
    	at lombok.javac.apt.LombokProcessor.placePostCompileAndDontMakeForceRoundDummiesHook(LombokProcessor.java:174)
    	at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:96)
    	at lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:160)
    	at lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:213)
    	at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:64)
    	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:633)
    	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:760)
    	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:856)
    	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1199)
    	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1312)
    	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1272)
    	at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1174)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:348)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:399)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.generate(JavacTaskImpl.java:465)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$generate$0(JavacTaskImpl.java:445)
    	at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
    	... 21 more
    Caused by: java.lang.NoSuchFieldException: com.sun.tools.javac.code.TypeTag :: UNKNOWN
    	at lombok.permit.Permit.getField(Permit.java:144)
    	at lombok.javac.JavacTreeMaker$SchroedingerType.getFieldCached(JavacTreeMaker.java:171)
    	at lombok.javac.JavacTreeMaker$TypeTag.typeTag(JavacTreeMaker.java:259)
    	at lombok.javac.Javac.<clinit>(Javac.java:187)
    	... 38 more
    
    
    
  21. snjeza commented on Apr 28, 2025

    @snjeza
    Collaborator

    @viswatejan You need to use JDK 24, lombok 1.18.38 and set "java.jdt.ls.lombokSupport.enabled": false,
    Also, try to clean the workspace.

    Caused by: java.lang.NoSuchFieldException: com.sun.tools.javac.code.TypeTag :: UNKNOWN

    This exception is thrown when using older lombok and JDK 24.

  22. viswatejan commented on Apr 29, 2025

    @viswatejan

    I tried that but still getting the same error.

    FYI, I am using vscode-java 1.41.1.

    Image
  23. snjeza commented on Apr 29, 2025

    @snjeza
    Collaborator

    @viswatejan Could you attach your project?

  24. viswatejan commented on Apr 29, 2025

    @viswatejan

    @snjeza, you can try with this.
    demo.zip

  25. snjeza commented on Apr 29, 2025

    @snjeza
    Collaborator

    @viswatejan Could you try to configure the maven-compiler-plugin as follows:

    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-compiler-plugin</artifactId>
    				<configuration>
    					<annotationProcessorPaths>
    						<path>
    							<groupId>org.projectlombok</groupId>
    							<artifactId>lombok</artifactId>
    							<version>1.18.38</version> <!-- use 1.18.38 version -->
    						</path>
    					</annotationProcessorPaths>
    				</configuration>
    			</plugin>
    
    
  26. viswatejan commented on Apr 29, 2025

    @viswatejan

    Now I see a different issue. Intellisense is broken for the classes using the lombok and it is working fine for the other classes.

    Image

    Image

  27. snjeza commented on Apr 30, 2025

    @snjeza
    Collaborator

    @viswatejan Could you try to set:

    "java.jdt.ls.vmargs": "-DICompletionEngineProvider=org.eclipse.jdt.core.dom.DOMCompletionEngineProvider  <your_vmargs",
    
  28. viswatejan commented on May 1, 2025

    @viswatejan

    @snjeza, unfortunately that broke the intellisense entirely.

    Image

    Image

  29. snjeza commented on May 1, 2025

    @snjeza
    Collaborator

    @viswatejan This is an upstream jdt-core-incubator issue.
    You can try to save the file and call the completion again (Ctrl+s, Ctrl+Space).

  30. viswatejan commented on May 2, 2025

    @viswatejan

    I have enabled auto-save and also even after saving, I am seeing the same.

  31. abilliontokens commented on Nov 7, 2025

    @abilliontokens

    was it fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions