redhat-developer / redhat-developer/vscode-java

Visual Studio Code's Java Compiler Not Showing Certain Errors

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

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

compile
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ả

Description of the Issue

When running Java code I have noticed that certain compile time errors will not be displayed.

Environment
  • Operating System: Windows x64 10
  • JDK version: 11.0.4.11
  • Visual Studio Code version: 1.41.1
  • Java extension version: 0.8.1
  • Java Debugger extension version: 0.23.0
Steps To Reproduce
  1. Declare the HashMap like,
    HashMap<dataTypeA, dataTypeB> name = new HashMap<dataTypeC, dataTypeD>();
    Where dataType A - D could be any data type I want it to be.

  2. The bug only occurs when dataTypeC is different from dataTypeA and or dataTypeD is different from dataTypeB.

Current Result

The compiler displays,
`Exception in thread "main" java.lang.Error: Unresolved compilation problem:

    at Test.main(Test.java:10)`
Expected Result

The compiler should display,
Unresolved compilation problems: Type mismatch: cannot convert from HashMap<dataTypeA,dataTypeB> to HashMap<dataTypeC,dataTypeD> The method put(dataTypeA,dataTypeB) in the type HashMap<dataTypeC,dataTypeD> is not applicable for the arguments (dataTypeA,dataTypeB)

Additional Informations

If I want to see the error message then I have to read the class file in order to determine what the error is and what line it is on. The bug will only occur if the data structure is declared as a class member. I have been able to reproduce this bug with other data structures such as ArrayList, 1D list, and 2D list.

VSCodeBugReport

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 bằng cách tái hiện lỗi không khớp kiểu generic của HashMap trong Visual Studio Code với một khai báo thành viên lớp, sử dụng các phiên bản Java và extension được liệt kê. So sánh đầu ra trình biên dịch được hiển thị với các chẩn đoán không khớp kiểu và đối số phương thức dự kiến; được xem là hoàn tất khi các lỗi đó cùng vị trí trong mã nguồn của chúng được hiển thị, bao gồm cả các trường hợp collection khác được liệt kê.

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
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
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/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.