vscode-lombok icon indicating copy to clipboard operation
vscode-lombok copied to clipboard

The extension breaks java/vscode

Open noschang opened this issue 3 years ago • 6 comments

OK, I don't know what exactly happens so I'll have to write a long text to explain it, here it goes.

Part 1 - The problem

I've created a brand new spring project using the vscode spring boot initialzr extension and run the project successfully. Then, I added your extension so I could use lombok on my project. Vscode asked me to restart/reload and as soon as vscode opened I received the message "Language Support for Java Server crashed 5 times in the last 3 minutes".

Checking the project folder, I found out that the JVM crashed and several core dump files were created in the folder, each one with 1GB+ size. First I thought it was a problem with that Java Server extension and/or with my project. But after trying several things, to solve it there was nothing left but remove your extension.

I removed it and found another problem which was already reported in this issue https://github.com/redhat-developer/vscode-java/issues/1175 and apparently is not fixed yet. I did what was suggested in that issue and removed the JVM parameters referencing your extension and the project opened again without crashing the JVM.

NOTE: anyone reading this issue and having this problem on Linux, the path for the file that need to be fixed is $HOME/.config/Code/User/settings.json

Part 2 - The solution

I obviously couldn't build the project because lombok was not on my classpath anymore. This was when I tried to do something very specific (don't know why, just luck I guess) and that solved the problem for me.

  1. I ensured that your extension was completely removed checking the vscode extensions folder (on Linux $HOME/.vscode/extensions)

  2. I removed all Java and Spring extensions using the vscode extension manager

  3. After removing all these extensions I closed and reopened vscode to check if no errors were occuring. Everything was OK

  4. I reinstalled only your extension using vscode extension manager, but this time, when vscode asked me to restart, I denied and closed vscode manually to prevent it from opening again

  5. With vscode closed I downloaded the last version of Lombok (1.18.18) and replaced the jar on your extension folder with it

  6. Then I reopened vscode and reinstalled all Java and Spring extensions

And voila!! No errors, the code started compiling and I could run the project normally

Phew, that was a long text, thanks for your patience!

Part 3 - The conclusion

After thinking for a while why this worked, a light bulb popped over my head. Here's what I think it's happening. When we include lombok in the project dependencies using gradle, usually this is done this way:

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

If you pay attention closely, you will see that the version of Lombok is not specified, which probably means that Gradle/Maven downloads the latest version and add to the classpath. This is the version that will be used to compile the project.

When I was replacing your jar by the one downloaded from the lombok site, I noticed that the size of your jar was slightly smaller. This makes me think that your jar is an older version. Probably what happens is that your jar expects an older version of lombok in the classpath that matches it, but since gradle grabbed the latest one from the repository, a JAR HELL occurred and crashed the JVM!

Oh dear! I should have listened to my mom and become a lawyer! Maybe I should sell my laptop and buy a popcorn machine to sell popcorn on a square.

Anyways, I have nothing to support this theory, but it's the best that my brain can do for now, at 1:08pm! Thank you for your great work until here, your extension is very useful and I'll be very happy if you find a way to help us all.

noschang avatar Feb 25 '21 04:02 noschang

Hi, I just experienced exactly the same issue. Those dumps could fill a hard-drive pretty quick. I did the similars manuals steps and It worked fine. ( Java 15 / maven 3.6 )

antoineclaval avatar Mar 14 '21 22:03 antoineclaval

Had a similar issue, but instead of uninstalling all the Java extensions and the Lombok extension, I only uninstalled the Lombok extension and reloaded the window. This was the only way I could get the "Please restart VSCode" notification to appear after re-installing Lombok.

Then, instead of restarting, I followed the same steps of closing VSCode (instead of restarting) and copying lombok.jar into the extension folder, then re-opening VSCode.

michael-mml avatar Mar 29 '21 02:03 michael-mml

@noschang There's definitely an issue that causes weird behavior when the jars in the maven dependencies don't match what is provided by this extension. I noticed in this commit, it updates the jar to 1.18.12: https://github.com/GabrielBB/vscode-lombok/blob/master/server/lombok.jar. However, the most recent version of lombok from maven repo vis-a-vis spring boot initializer is 1.18.18.

When these versions were different, it was getting stuck on a @JsonProperty annotation as seen in the output of the Java Language Server log snippet below.

This would also have the weird effect of not allowing automatic imports of something as auto importing java.util.List for a simple property type of private List<String> usernames;

Brute Force Fix. (Fragile)

to fix this, I copied over the jar from the maven repo to ~/.vscode/extensions/gabrielbb.vscode-lombok-1.0.1/server/lombok.jar

This is a pretty fragile fix. Is there a preferred way to sync up the jars when specified by two different sources?

Java Language Server Log (snippet)

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:53.439
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:53.449
!MESSAGE >> document/documentSymbol

!ENTRY org.eclipse.jdt.core 4 4 2021-04-06 13:01:53.509
!MESSAGE Exception occurred during compilation unit conversion:
----------------------------------- SOURCE BEGIN -------------------------------------
package com.paraware.sizing.room;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Data;

@Data
public class Room {
    private Integer id;
    /** Name of this room */
    private String name;
    /** Name of the creator of this room */
    private String creator;
    /** Date this room was created */
    private Date created;

    /** Password for this room - hash this value */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
}

----------------------------------- SOURCE END -------------------------------------
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.core.manipulation 4 2 2021-04-06 13:01:53.510
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.core.manipulation".
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.core.manipulation 4 0 2021-04-06 13:01:53.511
!MESSAGE Error in JDT Core during AST creation
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:53.601
!MESSAGE >> document/foldingRange

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:53.657
!MESSAGE >> document/codeAction

!ENTRY org.eclipse.jdt.core 4 4 2021-04-06 13:01:53.680
!MESSAGE Exception occurred during compilation unit conversion:
----------------------------------- SOURCE BEGIN -------------------------------------
package com.paraware.sizing.room;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.Data;

@Data
public class Room {
    private Integer id;
    /** Name of this room */
    private String name;
    /** Name of the creator of this room */
    private String creator;
    /** Date this room was created */
    private Date created;

    /** Password for this room - hash this value */
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String password;
}

----------------------------------- SOURCE END -------------------------------------
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.core.manipulation 4 2 2021-04-06 13:01:53.682
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.core.manipulation".
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.core.manipulation 4 0 2021-04-06 13:01:53.683
!MESSAGE Error in JDT Core during AST creation
!STACK 0
java.lang.IllegalArgumentException: startPos = 446 and length is -306.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
class org.eclipse.jdt.core.dom.MemberValuePair: access=JsonProperty.Access.WRITE_ONLY
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:36)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2538)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2587)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1097)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5663)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5607)
    at org.eclipse.jdt.core.dom.ASTConverter.setModifiers(ASTConverter.java:5722)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToFieldDeclaration(ASTConverter.java:3633)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleFieldDeclaration(ASTConverter.java:541)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:201)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:3316)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1513)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:323)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1231)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:820)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider$1.run(CoreASTProvider.java:272)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.createAST(CoreASTProvider.java:264)
    at org.eclipse.jdt.core.manipulation.CoreASTProvider.getAST(CoreASTProvider.java:197)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getASTRoot(CodeActionHandler.java:282)
    at org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:120)
    at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$14(JDTLanguageServer.java:646)
    at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:53.713
!MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:54.649
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:54.674
!MESSAGE >> java/findLinks

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:55.153
!MESSAGE >> document/hover

!ENTRY org.eclipse.jdt.ls.core 1 0 2021-04-06 13:01:56.665
!MESSAGE >> document/codeAction```

bkbonner avatar Apr 06 '21 18:04 bkbonner

My solution was:

  • Uninstall lombok extension

  • Using wsl command line tools

  • Lock the lombok dependency to version 1.18.12 in both the dependency management and compiler plugin management sections of my pom files <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.12</version> <scope>provided</scope> </dependency> ` <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> 3.8.0 ${java.version} ${java.version} <annotationProcessorPaths> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> 1.18.12 </annotationProcessorPaths>

      		</plugin>
      		<plugin>
      			<groupId>org.apache.maven.plugins</groupId>
      			<artifactId>maven-war-plugin</artifactId>
      			<version>3.2.2</version>
      			<configuration>
      				<failOnMissingWebXml>false</failOnMissingWebXml>
      			</configuration>
      		</plugin>`
    
  • mvn clean install

  • Start a new workspace

  • Install lombok

temecom avatar Jun 15 '21 15:06 temecom

Spent the last hour trying to figure out what the heck was going on. Realized @Setter and @JsonProperty imports were conflicting with one another. Removing one or the other solves the issues I was experiencing in VSCode.

However, I don't believe this extension has anything to do with it. I uninstalled the extension entirely and the language server was still having hiccups when both imports were present.

ccarv avatar Jul 20 '21 19:07 ccarv

Hmm, copying over lombok.jar seemed to fix it for me. Did you restart your language server to verify it wasn't in the classpath? I'm wondering if the jar file that caused it to break is still in the classpath.

bkbonner avatar Jul 22 '21 02:07 bkbonner