redhat-developer / redhat-developer/vscode-java
Package error not reported with "java.jdt.ls.javac.enabled":"on"
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.3k
- Fork
- 546
- Merge trung bình
- 20 giờ 1 phút
- Pull request đã merge (30 ngày)
- 11
Mô tả
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?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Giải nén Demo25-javac-on.zip và tái hiện vấn đề với "java.jdt.ls.javac.enabled":"on" bằng cách so sánh foo\bar\ex02.java với ex01.java và ex03.java. Kiểm tra cách các chẩn đoán package và các đường dẫn class-file của workspace-cache được tạo ra, sau đó xác minh rằng ex02.java và ex03.java báo cáo lỗi package, đồng thời các lớp được lưu trong bộ nhớ đệm vẫn giữ các thư mục nguồn của chúng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java, typescript, vscode
- Lĩnh vực
- developer-experience, tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100