Java – generate warnings for auto boxing usage

I want to generate warnings for all auto boxing and unboxing

Has anyone found an effective way?

Eclipse captures basic auto boxing errors: for example Integer I = null; I However, any complicated things have failed, not my future

I've seen PMD and checkstyle, but I can't find anything

I know it's a controversial topic, but I think it's a dangerous feature There is no way to disable it, so I at least like the reports checked during code review

I often see this NullPointerException in code review and errors:

class X {
    Integer i = null;

    public int doSomething() {
        return i + 2;
    }
}

I want to stop it from going away

Solution

Set this setting in eclipse,

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>