redhat-developer / redhat-developer/vscode-java

Partial jdk classes cannot be resolved. It is indirectly reference from required ...

オープン
#3,365 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

  1. Open spring-petclinic project in VS Code and observe the compilation error below.
[{
	"resource": "/C:/Work/Code/spring-petclinic/src/test/java/org/springframework/samples/petclinic/PetClinicIntegrationTests.java",
	"owner": "_generated_diagnostic_collection_name_#4",
	"code": "16777563",
	"severity": 8,
	"message": "The type java.lang.Enum cannot be resolved. It is indirectly referenced from required type org.springframework.boot.test.context.SpringBootTest.WebEnvironment",
	"source": "Java",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 2
}]

image

  1. In the Java Projects view, Enum.class is also not resolved in the JRE tree view.

image

  1. Click Enum.class in the JRE tree view, Java extension reports error as below.
!ENTRY org.eclipse.jdt.ls.core 4 0 2023-10-26 16:12:15.657
!MESSAGE Enum.class [in java.lang [in <module:java.base>]] does not exist
!STACK 1
Java Model Exception: Error in Java Model (code 969): Enum.class [in java.lang [in <module:java.base>]] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:550)
	at org.eclipse.jdt.internal.core.ClassFile.getBinaryTypeInfo(ClassFile.java:203)
	at org.eclipse.jdt.internal.core.ClassFile.buildStructure(ClassFile.java:92)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:266)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:573)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:304)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:290)
	at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:296)
	at org.eclipse.jdt.internal.core.AbstractClassFile.getBuffer(AbstractClassFile.java:245)
	at org.eclipse.jdt.internal.core.AbstractClassFile.getSourceRange(AbstractClassFile.java:371)
	at org.eclipse.jdt.ls.core.internal.JDTUtils.resolveTypeRoot(JDTUtils.java:452)
	at org.eclipse.jdt.ls.core.internal.handlers.FoldingRangeHandler.foldingRange(FoldingRangeHandler.java:66)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$30(JDTLanguageServer.java:1027)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$59(JDTLanguageServer.java:1216)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 2023-10-26 16:12:15.657
!MESSAGE Enum.class [in java.lang [in <module:java.base>]] does not exist
  1. I cannot reproduce this issue consistently, but I encountered it twice in my local environment recently. Reloading the window usually fixes it. I am opening this issue to see if anyone else has the same problem.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

spring-petclinic プロジェクトで問題を再現し、Java Projects JRE ツリーと併せて PetClinicIntegrationTests.java の診断を調査します。まず、Enum.class が見つからないというレポートと org.eclipse.jdt.ls.core の stack trace を確認し、その後、VS Code ウィンドウを再読み込みする前後の動作を比較します。部分的な JDK クラスによって報告された解決エラーが発生しなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, vscode
領域
devtools, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。