Skip to content

Java: document nullness false negative as qltest #20171

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

Merged
merged 1 commit into from
Aug 5, 2025

Conversation

aschackmull
Copy link
Contributor

The correlated conditions logic doesn't properly account for loops.

@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 11:55
@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Aug 5, 2025
@aschackmull aschackmull requested a review from a team as a code owner August 5, 2025 11:55
@github-actions github-actions bot added the Java label Aug 5, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR documents a false negative in the nullness analysis by adding two test cases to the Java test suite. The issue involves correlated conditions logic not properly accounting for loops, where control flow can iterate and create scenarios where null pointer exceptions should be detected but aren't.

  • Adds test cases demonstrating false negative behavior in nullness analysis within loops
  • Documents the difference between loop-scoped and iteration-scoped variable behavior
Comments suppressed due to low confidence (2)

java/ql/test/query-tests/Nullness/B.java:412

  • [nitpick] The parameter name 'a' is not descriptive. Consider renaming it to 'conditions' or 'flags' to better indicate its purpose in testing correlated conditions.
  public void corrCondLoop1(boolean a[]) {

java/ql/test/query-tests/Nullness/B.java:426

  • [nitpick] The parameter name 'a' is not descriptive. Consider renaming it to 'conditions' or 'flags' to be consistent with the test's purpose.
  public void corrCondLoop2(boolean a[]) {

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected some changes to a .expected file?

@aschackmull
Copy link
Contributor Author

I would have expected some changes to a .expected file?

It's not an inline expectations test, and the two new cases are FN and TN, resp., so that means no .expected changes.

@aschackmull aschackmull merged commit 1823355 into github:main Aug 5, 2025
12 checks passed
@aschackmull aschackmull deleted the java/nullness-fn branch August 5, 2025 12:17
@hvitved
Copy link
Contributor

hvitved commented Aug 5, 2025

It's not an inline expectations test, and the two new cases are FN and TN, resp., so that means no .expected changes.

Ah, yes, I mistakenly read the second example as a TP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants