redhat-developer / vscode-java

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

Internal compiler error: java.lang.NoClassDefFoundError: org/eclipse/jdt/core/search/SearchPattern #3046

Closed Eskibear closed 1 year ago

Eskibear commented 1 year ago

Open this simple maven project in vscode, I see two build errors, might be related to lombok support from detailed message.

After reloading window, errors are gone. I only copied one of the two diagnostics as below:

[{
    "resource": "/C:/Users/admin/git/microsoft/vscode-maven/test/projects/multi-module/module1/src/main/java/com/mycompany/app/App.java",
    "owner": "_generated_diagnostic_collection_name_#2",
    "code": "0",
    "severity": 8,
    "message": "Internal compiler error: java.lang.NoClassDefFoundError: org/eclipse/jdt/core/search/SearchPattern at java.base/java.lang.Class.getDeclaredMethods0(Native Method)",
    "source": "Java",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 2
}]

jdtls-log.txt

jdtls-log-after-reloading.txt

vscode-java@v1.17.2023040504

snjeza commented 1 year ago

It is an upstream lombok issue. Steps to reproduce

After reloading window, errors are gone

I can reproduce the issue even after reloading the window if close all editors.

@Eskibear could you check VS Code 1.17.4? Please clean the workspace after updating to 1.17.4

Eskibear commented 1 year ago

could you check VS Code 1.17.4?

I tried reloading a couple of times, and the issue didn't occur. Because I was not able to stably reproduce it, I'm not sure if it indeed fixes the issue, or just due to good luck. I suggest that you open a PR so we can dig deeper and see if that's really related.

snjeza commented 1 year ago

There is an issue in lombok.

I suggest that you open a PR so we can dig deeper and see if that's really related.

VS Code 1.17.4 includes a workaround. I will try to find a better fix.

I was not able to stably reproduce it

You can

yuyully commented 1 year ago

I can repo this issue with just opening https://github.com/redhat-developer/vscode-java/tree/master/test/resources/projects/maven/salut (or gradle/simple-gradle, gradle-11, maven/salut-java11, these projects all can repro).

Eskibear commented 1 year ago

I also repro it in codespaces with spring-petclinic these days. Then I disabled lombok support via settings as a workaround.

FYI @testforstephen @rgrunber @jdneo

testforstephen commented 1 year ago

@Eskibear @v-yuyul thanks for the information. I'm testing whether it's caused by the PR https://github.com/redhat-developer/vscode-java/pull/3031. If so, we need to revert this PR.

Eskibear commented 1 year ago

There is an issue in lombok.

@snjeza Is there any issue tracking this? Can you link it here so people can have more context info?

testforstephen commented 1 year ago

This new regression seems to happen more frequently (in new machine) than the old regression https://github.com/redhat-developer/vscode-java/issues/2887, I would like to revert to the previous version 1.18.24 until this issue is resolved.

@snjeza If you have found the root cause about this new regression, could you pls open a pull request to the upstream Lombok project?

snjeza commented 1 year ago

If you have found the root cause about this new regression,...

@testforstephen It is caused by https://github.com/projectlombok/lombok/commit/afceb138e6e4ca2dca0f16fd5297d7451f5f4e80 You may want to take a look at https://github.com/projectlombok/lombok/issues/3403 I have created a workaround for jdtls.

could you pls open a pull request to the upstream Lombok project?

I will try https://github.com/projectlombok/lombok/pull/3378 fixes the issue.

testforstephen commented 1 year ago

this has been fixed in 1.18, close it.