Java: Fix assert CFG by properly tagging the false successor.#19883
Merged
aschackmull merged 3 commits intogithub:mainfrom Jun 26, 2025
Merged
Java: Fix assert CFG by properly tagging the false successor.#19883aschackmull merged 3 commits intogithub:mainfrom
aschackmull merged 3 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a dedicated CFG node for failing assert statements and updates tests accordingly.
- Remove stale expected warnings for
assert-false paths in Nullness tests - Update test comment to reflect that the correlated conditions are now handled
- Introduce
TAssertThrowNodeandAssertThrowNodein the CFG and wire upassertfailures
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| java/ql/test/query-tests/Nullness/NullMaybe.expected | Remove three outdated expected-warning lines for xs. |
| java/ql/test/query-tests/Nullness/C.java | Change comment on xs[0] = 42; from “FP...” to “OK”. |
| java/ql/lib/semmle/code/java/ControlFlowGraph.qll | Add TAssertThrowNode type and AssertThrowNode class; update CFG rules for assert. |
Comments suppressed due to low confidence (1)
java/ql/lib/semmle/code/java/ControlFlowGraph.qll:103
- [nitpick] The new
TAssertThrowNode(AssertStmt s)case in theTNodenewtype lacks a brief comment. Please add documentation describing its purpose (i.e., modeling a failingassert).
TExitNode(Callable c) { exists(c.getBody()) } or
owen-mc
approved these changes
Jun 26, 2025
Contributor
owen-mc
left a comment
There was a problem hiding this comment.
Great to see a new CFG node being added.
Contributor
Author
I've got more: #19885 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up for #19573 to fix the small issue with asserts.