redhat-developer / redhat-developer/vscode-java

Java Model Exception: Java Model Status [src/main/java/suddenly.in.dot.notation [in some-maven-submodule] is not on its project's build path]

Open
#588 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

classpath ls-error/crash
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I have a maven project, with 5 submodules, nothing too special, Spring Boot 2, Lombok, AWS SDK. Project builds fine, ie, I can mvn test/compile/package/install to hearts' delight.

When I open this project in VS Code, I get the following errors (many of them, see also attached log):

!ENTRY org.eclipse.jdt.ls.core 4 0 2018-07-11 18:14:02.128
!MESSAGE Failed to publish diagnostics.
!STACK 1
Java Model Exception: Java Model Status [src/main/java/this.in.dot.notation.why [in aesop-dfp] is not on its project's build path]
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:580)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:253)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:527)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:527)
	at org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1240)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:247)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:593)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:323)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:309)
	at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:295)
	at org.eclipse.jdt.ls.core.internal.handlers.BuildWorkspaceHandler.publishDiagnostics(BuildWorkspaceHandler.java:112)
	at org.eclipse.jdt.ls.core.internal.handlers.BuildWorkspaceHandler.buildWorkspace(BuildWorkspaceHandler.java:65)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$21(JDTLanguageServer.java:672)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$22(JDTLanguageServer.java:716)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:443)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
!SUBENTRY 1 org.eclipse.jdt.core 4 1006 2018-07-11 18:14:02.132
!MESSAGE src/main/java/this.in.dot.notation.why [in aesop-dfp] is not on its project's build path

Note: I changed the package name.

Environment
  • Operating System: Windows 10 x64
  • JDK version: OpenJDK 8 r163 x64
  • Visual Studio Code version: 1.25.0
  • Java extension version: 0.28.0
Steps To Reproduce
  1. Open Maven project in VS code
  2. Open log file (see attached)

jdt-ls.log

Current Result

Code completion doesn't work.

Expected Result

Code completion works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached jdt-ls.log and follow the stack trace through BuildWorkspaceHandler.publishDiagnostics/buildWorkspace and JDTLanguageServer. Reproduce the five-submodule Maven project setup described in the issue, then verify that workspace diagnostics no longer report Java sources as outside the build path and that code completion works.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.