Java: Fix some Ql4Ql violations.#20328
Merged
michaelnebel merged 2 commits intogithub:mainfrom Sep 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes various Ql4Ql violations across Java CodeQL files, focusing on code quality improvements based on specific checks like field usage optimization, casting opportunities, parameter naming consistency, and documentation accuracy.
- Updates code patterns to use more efficient constructs (e.g.,
not exists()instead ofcount() = 0) - Corrects spelling errors and improves parameter documentation consistency
- Refactors conditional logic to eliminate unnecessary if-then-else patterns
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| java/ql/src/utils/flowtestcasegenerator/FlowTestCase.qll | Updates parameter names in documentation comments for clarity |
| java/ql/src/experimental/quantum/Examples/BrokenCrypto.ql | Fixes spelling from "MODELLING" to "MODELING" |
| java/ql/src/experimental/quantum/Analysis/ArtifactReuse.qll | Simplifies exists pattern by removing unnecessary variable |
| java/ql/src/Violations of Best Practice/Naming Conventions/ConfusingOverloading.ql | Corrects parameter name in documentation |
| java/ql/src/Violations of Best Practice/Magic Constants/MagicConstants.qll | Fixes spelling of "occurrence" in predicate names |
| java/ql/src/Likely Bugs/Termination/SpinOnField.ql | Replaces count-based checks with more efficient exists patterns |
| java/ql/src/Likely Bugs/Concurrency/NotifyWithoutSynch.ql | Adds missing parameter documentation |
| java/ql/src/Likely Bugs/Comparison/HashedButNoHash.ql | Updates predicate documentation format |
| java/ql/lib/semmle/code/java/security/UnsafeDeserializationQuery.qll | Corrects parameter name in documentation |
| java/ql/lib/semmle/code/java/security/TempDirUtils.qll | Improves parameter documentation clarity |
| java/ql/lib/semmle/code/java/security/FileWritable.qll | Fixes parameter name in documentation |
| java/ql/lib/semmle/code/java/security/CleartextStorageAndroidFilesystemQuery.qll | Corrects parameter name in documentation |
| java/ql/lib/semmle/code/java/frameworks/javaee/ejb/EJB.qll | Replaces count-based logic with exists patterns |
| java/ql/lib/semmle/code/java/frameworks/Mockito.qll | Simplifies if-then-else logic and removes unnecessary field |
| java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/SignAnalysisSpecific.qll | Adds missing parameter names in documentation |
| java/ql/lib/semmle/code/java/dataflow/internal/DataFlowUtil.qll | Updates parameter names in location documentation |
| java/ql/lib/semmle/code/java/dataflow/internal/ContainerFlow.qll | Enhances documentation with missing parameter details |
| java/ql/lib/semmle/code/java/Statement.qll | Adds missing parameter names in documentation |
| java/ql/lib/semmle/code/java/Conversions.qll | Removes unused field and moves logic into constructor |
| java/ql/lib/semmle/code/java/Concurrency.qll | Adds missing parameter documentation |
| java/ql/lib/printAst.ql | Adds missing parameter names in documentation |
| java/ql/lib/experimental/quantum/Language.qll | Fixes spelling from "modelled" to "modeled" |
| java/ql/lib/experimental/quantum/JCA.qll | Fixes spelling, removes unused fields, and simplifies expressions |
aschackmull
reviewed
Sep 2, 2025
aschackmull
reviewed
Sep 2, 2025
Contributor
aschackmull
left a comment
There was a problem hiding this comment.
One inline comment, otherwise LGTM.
Co-authored-by: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
aschackmull
approved these changes
Sep 2, 2025
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.
Fix some Ql4Ql violations based on the following checks
ql/field-only-used-in-charpredql/could-be-castql/counting-to-zeroql/dataflow-module-naming-conventionql/if-with-noneql/missing-parameter-qldocql/misspellingDCA looks good.