redhat-developer / redhat-developer/vscode-java
Package error not reported with "java.jdt.ls.javac.enabled":"on"
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 2.3k
- フォーク
- 546
- 平均マージ
- 20時間 1分
- マージ済み PR(30日)
- 11
説明
Describe the bug
When using "java.jdt.ls.javac.enabled":"on" on a unmanaged project, if the package does not match the folder hierarchy, no error is reported in VSCode interface
To Reproduce
- Unzip Demo25-javac-on.zip
- Open folder ... Demo25-javac-on
- Open file foo\bar\ex02.java -> The package is incorrect (bar instead of foo.bar) but no error is reported
- File ex01.java has the correct package
- File ex03.java has no package (compact source file)
Expected behavior
A package error should be reported for ex02.java and ex03.java . In fact, the class file are not placed in the correct folders in the workspace cache folder (see left side of the picture below). When javac is on, the class are placed in folders according to the package declared in the java file instead of the original folder hierarchy. So since the class file matches the package, no package error is reported. The correct behavior is to keep the class files in the same folders of the source java files like when javac is off (right side of picture below)
Screenshots
Environment
- Operating System: Debian 13
- JDK version: 25
- Visual Studio Code version: 1.121
- Java extension version: 1.54.0
Additional Information
Maybe it is a problem in the JDT-LS from Eclipse?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Demo25-javac-on.zip を解凍し、foo\bar\ex02.java と ex01.java および ex03.java を比較して、"java.jdt.ls.javac.enabled":"on" で問題を再現します。package diagnostics と workspace-cache の class-file パスがどのように生成されるかを調査し、その後 ex02.java と ex03.java が package エラーを報告し、キャッシュされたクラスがソースフォルダーを保持していることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, typescript, vscode
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100