-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Java: Consolidate Assertions.qll and Preconditions.qll. #20377
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
Conversation
63fae98 to
39578c6
Compare
There was a problem hiding this 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 consolidates two similar libraries (Assertions.qll and Preconditions.qll) that provide overlapping functionality for modeling assertion and precondition checks. The consolidation centralizes this functionality into the enhanced Preconditions.qll library and updates all references accordingly.
- Deprecates the existing
Assertions.qlllibrary - Expands
Preconditions.qllwith comprehensive assertion and precondition modeling - Updates all import statements and method calls to use the consolidated library
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| DeadLocals.qll | Updates import from Assertions to Preconditions and inlines assertion logic |
| Assertions.qll | Marks library as deprecated |
| Nullness.qll | Switches import from Assertions to Preconditions and simplifies null checking logic |
| Preconditions.qll | Consolidates functionality from both libraries with new predicates and deprecation notices |
| Guards.qll | Updates method calls to use new consolidated API |
| ControlFlowGraph.qll | Updates method calls to use new consolidated API |
7b62eb8 to
2145a88
Compare
2145a88 to
b5c7bc1
Compare
|
Finally got a dca run that I'm happy with. There are a number of small result changes, so I've added a change note to cover that. |
| | | ||
| ma.getAnArgument().(MethodCall).getMethod().getName() = "notNullValue" | ||
| ) | ||
| private ControlFlowNode ensureNotNull(SsaVariable v) { result = varDereference(v, _) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the QlDoc needs to be changed as the assertion related logic has been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that needs a slight cleanup. Do you mind if I postpone that to #20367? (Which I'm going to rebase once this is merged)
| */ | ||
| overlay[local?] | ||
| module; | ||
| deprecated module; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice that it is possible to deprecate the entire module!
michaelnebel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The two libraries do very similar things and overlap somewhat with neither being a subset of the other. This PR consolidates the models of both libraries into a single library and ensures that it is properly recognized by the Guards library.