Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] A false negative about the rule NULL_DEREFERENCE #1792

Open
LynnBroe opened this issue Sep 28, 2023 · 0 comments
Open

[java] A false negative about the rule NULL_DEREFERENCE #1792

LynnBroe opened this issue Sep 28, 2023 · 0 comments

Comments

@LynnBroe
Copy link

Version. Infer version v1.1.0
OS. Ubuntu 22.04.3 LTS
Command. infer run -- mvn clean compile

I found a false negative about the rule NULL_DEREFERENCE.

In the example below, Infer report no warnings, but there is a NULL_DEREFERENCE bug at line 6.

import com.android.annotations.Nullable;
class A {
    @Nullable
    A obj;
    public void fun() {
        synchronized (obj) {  // report no warnings
            synchronized (this) {}
        }
    }
}

However, if I use androidx.annotation.Nullable instead of com.android.annotations.Nullable, Infer can report a warning at line 6. Hence, I think it is a false negative.

error: Null Dereference object `obj` last accessed on line 6 could be null and is dereferenced at line 6.
@LynnBroe LynnBroe changed the title [java] False negative about NULL_DEREFERENCE and @Nullable [java] False negative about the rule NULL_DEREFERENCE Sep 28, 2023
@LynnBroe LynnBroe changed the title [java] False negative about the rule NULL_DEREFERENCE [java] A false negative about the rule NULL_DEREFERENCE Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant