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

Tries to clean default workspace when it doesn't exist. #3153

Closed
ethan-vanderheijden opened this issue May 8, 2024 · 1 comment · Fixed by #3154
Closed

Tries to clean default workspace when it doesn't exist. #3153

ethan-vanderheijden opened this issue May 8, 2024 · 1 comment · Fixed by #3154
Milestone

Comments

@ethan-vanderheijden
Copy link
Contributor

The language server keeps logging the following error since #3140:

May 8, 2024, 3:44:46 PM Failed to build workspace.
jdt.ls-java-project does not exist
Java Model Exception: Error in Java Model (code 969): jdt.ls-java-project does not exist
        at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:572)
        at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:233)
        at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:585)
        at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:308)
        at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:294)
        at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java:249)
        at org.eclipse.jdt.internal.core.JavaProject.getPackageFragmentRoots(JavaProject.java:2294)
        at org.eclipse.jdt.internal.core.JavaProject.getPackageFragments(JavaProject.java:2318)
        at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager.cleanupResources(ProjectsManager.java:349)
        at org.eclipse.jdt.ls.core.internal.handlers.BuildWorkspaceHandler.buildWorkspace(BuildWorkspaceHandler.java:64)
        at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$28(JDTLanguageServer.java:1001)
        at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$61(JDTLanguageServer.java:1236)
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
        at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

The error comes from here:

if (ProjectUtils.getAllProjects(false).length == 0) {
ProjectsManager.cleanupResources(ProjectsManager.getDefaultProject());
}

It's trying to clean the default project even though it was never created. In my setup, I'm adding workspace folders through workspace/didChangeWorkspaceFolders, and for each workspace folder, it creates an invisibly linked project. Those invisible linked projects don't show up ProjectUtils.getAllProjects(false).

Maybe the solution is as simple as replacing it with if (ProjectsManager.getDefaultProject().exists())?

@snjeza
Copy link
Contributor

snjeza commented May 8, 2024

Maybe the solution is as simple as replacing it with if (ProjectsManager.getDefaultProject().exists())?

@ethan-vanderheijden Could you create a PR?

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

Successfully merging a pull request may close this issue.

3 participants