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

Possible bug in the data flow analysis? #1060

Open
mauricioaniche opened this issue Oct 24, 2024 · 1 comment
Open

Possible bug in the data flow analysis? #1060

mauricioaniche opened this issue Oct 24, 2024 · 1 comment

Comments

@mauricioaniche
Copy link
Contributor

All, we faced the following NullAway error: [NullAway] unboxing of a @Nullable value in the snippet below. However, as you can see, x can't be null at the point due to the triggered boolean value.

    public double execute(Entity entity, int a, int b) {
        Long x = entity != null ? 123L : null;

        boolean triggered;
        if (a > b) {
            triggered = x != null;
        } else {
            triggered = false;
        }

        double score = 1.0;
        if (triggered) {
            score = score - Utils.function(x); // <-- ERROR HERE!
        }
        return score;
    }

Now that I'm opening up this issue, I believe this can actually be due to #98 (i.e., lack of support for nullability stored in boolean variables). I'll still open up this issue to record that we faced it in a real-world project.

Project reproducing it: https://github.com/mauricioaniche/nullaway-bug.

Library versions:

  • NullAway: 0.12.0
  • Errorprone: 2.34.0
  • Java version: 17
@msridhar
Copy link
Collaborator

Thanks, @mauricioaniche! Yes, I believe this is #98 but I'll leave this one open as well since it's a good example to test on for when we try to fix that one.

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

2 participants