redhat-developer / redhat-developer/vscode-java

Add Xlint Support

Đang mở
#3,108 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.

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ả

My apologies in advance if this feature is already supported/implemented and I could not find it.

This extension does an excellent job of reporting most warnings, but recently I came across several warnings in my project that this extension was not reporting but I found through compiling with the -Xlint flag.

Take this SSCCE for example:

public class Test
{
    public static void main(String[] args)
    {
        int x = 3;
        int y = (int)x;

        System.out.println(y);
    }
}

This code runs perfectly fine with this extension with no warnings, but if you compile it with javac -Xlint Test.java, you will get this:

Test.java:6: warning: [cast] redundant cast to int
        int y = (int)x;
                ^      
1 warning

This is just one example but it seems there are other types of useful warnings that the Xlint flag gives that this extension does not report, such as not marking non-serializable fields as transient.

I understand the Xlint flag is comprised of many subflags (search for Xlint on this man page to see the options) that can be turned on and off to report or ignore different types of warnings, and users may not want to see all the warnings that -Xlint:all reports. Thus, it would nice for these additional warnings to not only be supported, but for the user to have the option to turn these individual warning categories on or off as you can when manually compiling your project.

My thanks in advance for your help!

Environment
  • Operating System: Windows 10
  • JDK version: 17.0.4.1
  • Visual Studio Code version: 1.78.2
  • Java extension version: 1.19.2023052004

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 lần theo cách extension gọi javac và hiển thị các cảnh báo của trình biên dịch; issue không nêu tên tệp, bài kiểm thử hay điểm vào nào trong repository. Sử dụng ví dụ Test.java được cung cấp và hành vi của javac -Xlint làm tham chiếu, đồng thời xác định hoàn thành là hỗ trợ các danh mục cảnh báo Xlint được yêu cầu với khả năng bật do người dùng cấu hình.

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
tooling
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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
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.