redhat-developer / redhat-developer/vscode-java

Importing package from non-transitively exposed dependency in Gradle project does not display error

Đang mở
#3,739 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Gradle
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
  1. Download the reproduction project.
  2. Open Test.java in VS Code and observe no compilation errors reported by this language server extension.
  3. Run gradle build, which will fail, and observe the compilation errors due to Test.java attempting to access the class of a non-transitively exposed dependency (com.google.common.base.Preconditions in the example) of the alpaca-java library.

Reproduction project: workspace.zip
Logs: Log.txt (nothing out of the ordinary)

Current Result

VS Code shows no errors:
VS Code

Expected Result

IntelliJ does show errors:
IntelliJ

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. 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

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.