Skip to content

Shared/Java: Add shared Guards library and switch Java to use it. #19573

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

aschackmull
Copy link
Contributor

@aschackmull aschackmull commented May 23, 2025

This adds a new shared Guards library, which provides complex implication logic between guards. The implementation is heavily inspired by the corresponding Java and C# versions.
The Java Guards library is then switched to use this new library, which results in a number of precision improvements for the nullness and useless comparison test queries.

There's currently a known FP related to correlated conditions in assert statements that I've documented as a qltest. I plan to fix that in a follow-up PR.

Review of the shared implementation (the single file shared/controlflow/codeql/controlflow/Guards.qll) is likely best done by reading the final result, but the other changes can be reviewed commit-by-commit.

}

private module LogicInput_v2 implements GuardsImpl::LogicInputSig {
private import semmle.code.java.dataflow.SSA as SSA

Check warning

Code scanning / CodeQL

Names only differing by case Warning

SSA is only different by casing from Ssa that is used elsewhere for modules.
@aschackmull aschackmull force-pushed the guardslib branch 2 times, most recently from 969365f to 4abca27 Compare May 27, 2025 06:50
@aschackmull aschackmull force-pushed the guardslib branch 2 times, most recently from c994232 to 41de038 Compare June 16, 2025 12:07
@aschackmull aschackmull marked this pull request as ready for review June 17, 2025 12:05
@aschackmull aschackmull requested a review from a team as a code owner June 17, 2025 12:05
@aschackmull aschackmull requested a review from hvitved June 17, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant