-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Java: Fix false positives in evaluation-to-constant query for ErrorType #20546
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
d66fbde to
b82d8c2
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
Fixes false positives in the evaluation-to-constant query for ErrorType by adding a type check to exclude TypeAccess expressions that resolve to ErrorType. This prevents the query from incorrectly flagging unresolved types as constant expressions.
- Added type check condition to exclude ErrorType instances from constant expression evaluation
- Added integration test to verify the fix works correctly for unresolved types like
Minecraft
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
ConstantExpAppearsNonConstant.ql |
Modified predicate to exclude TypeAccess expressions that resolve to ErrorType |
test.py |
Created integration test configuration |
Test.java |
Added test case with unresolved Minecraft type reference |
ConstantExpAppearsNonConstant.qlref |
Added query reference for integration test |
owen-mc
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.
Two minor suggestions.
.../integration-tests/java/evaluation-to-constant-errortype/ConstantExpAppearsNonConstant.qlref
Outdated
Show resolved
Hide resolved
java/ql/src/Likely Bugs/Arithmetic/ConstantExpAppearsNonConstant.ql
Outdated
Show resolved
Hide resolved
|
Late to the party, but I see that there are a ton of new results now besides of course a lot of removed results. Are these new TPs? |
|
Just checked some - these definitely look like a ton of new FPs, so that's quite unfortunate. I'll put up a PR with a fix. |
|
Fix here: #20600 |
|
Thanks for the fix @aschackmull! |
This PR fixes the FPs described in the issue linked below.
Closes: http://github.com/github/codeql-java-team/issues/425
DCA Nightly Buildless: https://github.com/github/codeql-dca-main/issues/31838
DCA Nightly: https://github.com/github/codeql-dca-main/issues/31839