- Notifications
You must be signed in to change notification settings - Fork1.7k
Java: Improve concatenation in loops#16859
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
- create test- check for statements being executed often
- add test for recursive function- update test expectations
- Use a deep callgraph traversal to identify loops. This should be checked for performance issues and possibly be restriceted/optimised.- Add inline expectation test. Currently dupicating the query code. It should be refactored so that the code can be reused.
/** | ||
* An assignment of the form | ||
* | ||
* ``` | ||
* v = ... + ... v ... | ||
* ``` | ||
* or | ||
* | ||
* ``` | ||
* v += ... | ||
* ``` | ||
* where `v` is a simple variable (and not, for example, | ||
* an array element). | ||
*/ |
Check warning
Code scanning / CodeQL
Predicate QLDoc style. Warning test
exists(ControlFlowNode n | a.getControlFlowNode() = n | getADeepSuccessor(n) = n) | ||
} | ||
/** Gets a sucessor of `n`, also following function calls. */ |
Check warning
Code scanning / CodeQL
Misspelling Warning
exists(ControlFlowNode n | a.getControlFlowNode() = n | getADeepSuccessor(n) = n) | ||
} | ||
/** Gets a sucessor of `n`, also following function calls. */ |
Check warning
Code scanning / CodeQL
Misspelling Warning test
} | ||
predicate queryResult(Assignment a) { | ||
exists(Variable v | |
Check warning
Code scanning / CodeQL
Omittable 'exists' variable Warning test
in this argument
Uh oh!
There was an error while loading.Please reload this page.
/** | ||
* Holds if `e` is executed often in loop `loop`. | ||
*/ | ||
predicate executedOften(Assignment a) { |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning
/** | ||
* Holds if `e` is executed often in loop `loop`. | ||
*/ | ||
predicate executedOften(Assignment a) { |
Check warning
Code scanning / CodeQL
Missing QLDoc for parameter Warning test
module TheQuery { | ||
import semmle.code.java.Type | ||
import semmle.code.java.Expr |
Check warning
Code scanning / CodeQL
Redundant import Warning test
semmle.code.java.Statement
Uh oh!
There was an error while loading.Please reload this page.
import semmle.code.java.Type | ||
import semmle.code.java.Expr | ||
import semmle.code.java.Statement | ||
import semmle.code.java.JDK |
Check warning
Code scanning / CodeQL
Redundant import Warning test
semmle.code.java.Type
Uh oh!
There was an error while loading.Please reload this page.
This is the results so far of a series of mob pairing sessions to improve the query finding concatenation in loops.
One thing I wanted to illustrate is the inline tests, but currently I had to include the query code in the test to make it work. Thus, this PR is not quite ready to merge.