redhat-developer / redhat-developer/vscode-java
Package error not reported with "java.jdt.ls.javac.enabled":"on"
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 2.3k
- Forks
- 546
- Ø Merge
- 20 Std. 1 Min.
- Gemergte PRs (30 T.)
- 11
Beschreibung
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?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Entpacke Demo25-javac-on.zip und reproduziere das Problem mit "java.jdt.ls.javac.enabled":"on", indem du foo\bar\ex02.java mit ex01.java und ex03.java vergleichst. Untersuche, wie Paketdiagnosen und Class-File-Pfade im workspace-cache erzeugt werden, und überprüfe anschließend, dass ex02.java und ex03.java Paketfehler melden und dass gecachte Klassen ihre Quellordner beibehalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java, typescript, vscode
- Bereich
- developer-experience, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100