redhat-developer / redhat-developer/vscode-java

Package error not reported with "java.jdt.ls.javac.enabled":"on"

Aperta
#4,414 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
TypeScript
Stelle
2.3k
Fork
547
Merge medio
20h 1m
PR unite (30g)
11

Descrizione

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

  1. Unzip Demo25-javac-on.zip
  2. Open folder ... Demo25-javac-on
  3. Open file foo\bar\ex02.java -> The package is incorrect (bar instead of foo.bar) but no error is reported
  4. File ex01.java has the correct package
  5. 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
Image

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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Decomprimi Demo25-javac-on.zip e riproduci il problema con "java.jdt.ls.javac.enabled":"on" confrontando foo\bar\ex02.java con ex01.java ed ex03.java. Esamina come vengono prodotti i diagnostici dei package e i percorsi dei file di classe di workspace-cache, quindi verifica che ex02.java ed ex03.java segnalino errori di package e che le classi memorizzate nella cache conservino le rispettive cartelle sorgente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, typescript, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.