redhat-developer / redhat-developer/vscode-java

Add Xlint Support

未关闭
#3,108 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪扩展如何调用 javac 并呈现编译器警告;该 issue 未指定任何仓库文件、测试或入口点。使用提供的 Test.java 示例和 javac -Xlint 的行为作为参考,并将支持所请求的 Xlint 警告类别且允许用户配置启用状态定义为完成标准。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
tooling
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。