redhat-developer / redhat-developer/vscode-java
Editor erroneously reports warning in conditional operator
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ả
Erroneous warnings are reported in the editor in conditional operators.
Environment
- Operating System: Windows 10 Pro
- JDK version: OpenJDK 11.0.1
- Visual Studio Code version: 1.30.1
- Java extension version: 0.40.0
Steps To Reproduce
Write code like the following:
SpeedController motor;
if (RobotMap.isCompetitionRobot)
{
motor = new WPI_TalonSRX(RobotMap.liftMotorCanDeviceId);
}
else
{
motor = new Spark(RobotMap.centerLegMotorPwmChannel);
}
motor = RobotMap.isCompetitionRobot
? new WPI_TalonSRX(RobotMap.liftMotorCanDeviceId)
: new Spark(RobotMap.centerLegMotorPwmChannel);
where the class Spark extends a class that implements AutoCloseable.
Current Result
No warnings are reported in the if statement. However, the warning:
Resource leak: '<unassigned Closeable value>' is never closed
is reported for the code:
new Spark(RobotMap.centerLegMotorPwmChannel)
in the conditional operator.
Expected Result
No warnings should be reported at all.
Additional Informations
None.
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 bằng cách tái hiện cảnh báo với ví dụ về toán tử điều kiện trong issue, sử dụng các phiên bản Windows, JDK, VS Code và Java extension được liệt kê khi có thể. Theo dõi quá trình phân tích rò rỉ tài nguyên của Java extension đối với các biểu thức điều kiện. Được xem là hoàn tất khi biểu thức điều kiện không tạo ra cảnh báo sai nào, trong khi hành vi của câu lệnh if hiện có vẫn không thay đổi.
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
- Lĩnh vực
- 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