redhat-developer / redhat-developer/vscode-java
Importing package from non-transitively exposed dependency in Gradle project does not display error
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ả
Gradle enables Java library authors to specify what dependencies should be transitively exposed to a consumer using the api or implementation configurations in the dependencies section of the library's build script. When a Gradle application project attempts to use a class from a transitive dependency of a library that has declared that dependency non-transitively exposed (using implementation), the gradle build command fails at the import declaration as expected, but this extension reports no errors in VS Code likely because it sees the dependency on the classpath and ignores its transitive visibility setting. This extension will also provide hinting and code completion for a non-transitively exposed library, which shouldn't be happening.
Environment
- Operating System: macOS/Docker ARM64
- JDK version: OpenJDK Runtime Environment Corretto-21.0.4.7.1
- Visual Studio Code version: 1.91.1 (through code-server)
- Java extension version: 1.33.0 (through OpenVSX)
Steps To Reproduce
- Download the reproduction project.
- Open
Test.javain VS Code and observe no compilation errors reported by this language server extension. - Run
gradle build, which will fail, and observe the compilation errors due toTest.javaattempting to access the class of a non-transitively exposed dependency (com.google.common.base.Preconditionsin the example) of thealpaca-javalibrary.
Reproduction project: workspace.zip
Logs: Log.txt (nothing out of the ordinary)
Current Result
VS Code shows no errors:
Expected Result
IntelliJ does show errors:
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
Bắt đầu với workspace.zip đính kèm, mở Test.java và chạy gradle build để so sánh các lỗi trình biên dịch của nó với các chẩn đoán của language server. Đọc thiết lập dependency của Gradle và Log.txt, sau đó lần theo cách xử lý khả năng hiển thị của dependency để import Guava không thể truy cập tạo ra lỗi và không nhận được gợi ý hoặc tính năng hoàn tất.
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, vscode
- Lĩnh vực
- build-system, devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 35/100