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]

未关闭
#588 12 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

classpath ls-error/crash
主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从附加的 jdt-ls.log 开始,沿着 stack trace 经过 BuildWorkspaceHandler.publishDiagnostics/buildWorkspace 和 JDTLanguageServer 进行跟踪。重现 issue 中描述的包含五个子模块的 Maven 项目设置,然后验证 workspace diagnostics 不再报告 Java 源文件位于 build path 之外,并且代码补全正常工作。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。