خرید بک لینک

Vote count: 0

I am using Findbugs together with the aotation javax.aotation.Noull. In following method

@Noull
public String methodA(@Noull String foo, @Noull Integer bar) {
    // missing checkNotNull(foo)
    // missing checkNotNull(bar)

    int fooLen = foo.length();    // did not check that foo is non-null

    retu (bar < fooLen)? foo : null; // did not check that bar is non-null
}

the params foo and bar are declared to be non-null, and they are subsequently dereferenced without first being checked if they are null. When I run Findbugs against the code (using the Gradle Findbugs plugin), the Findbugs report does not include the expected waing NP_ARGUMENT_MIGHT_BE_NULL. From the Findbugs website, the description of NP_ARGUMENT_MIGHT_BE_NULL:

NP: Method does not check for null argument (NP_ARGUMENT_MIGHT_BE_NULL)

A parameter to this method has been identified as a value that should always be checked to see whether or not it is null, but it is being dereferenced without a preceding null check.

What am I doing wrong?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 1 خرداد 1395 ساعت: 7:38

صفحه بندی