You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
java/print-array: an array appended to a string with += is not reported #23021
The query reports s + xs in PrintArraySeed.f(), where xs is an int[] that gets converted with Object.toString(). s += xs in PrintArrayVariant.f() does the same conversion (JLS 15.26.2 defines it as s = (String) (s + xs)) and gives the same [I@... text, but isn't reported.
Probably implicitToStringCall in StringFormat.qll. It covers an operand of a string-typed AddExpr, an argument of a print method and an argument of a formatting call, but s += xs is an AssignAddExpr. Error Prone's ArrayToString reports both forms.
I see you've opened a number of issues in the last few days. May I ask where these are coming from? Are these flagged up by some kind of testing tool? Or are you encountering these in real-world code?
They come out of a research project on analyzer consistency. We collected the false-positive and false-negative issues that maintainers had confirmed on the trackers of several Java analyzers (SpotBugs, sonar-java, CodeQL's own), pulled out the recurring shapes behind them (a negated guard, a statement moved into a lambda, a parenthesised expression, a constant instead of a literal, that kind of thing), and checked which of the other analyzers have the same gap. The CodeQL issues are the cases where it does. Each one is a hand-minimised pair we ran through the CLI, and I checked the open issues before filing.
Thanks for your reply. Note that we generally tune our queries on real world code, so if there's no indication that these problems occur in practice, we're not going to prioritize fixing these.
Activity
jketema commentedon Nov 5, 2026
Hi @MarkLee131,
Thanks for the report.
I see you've opened a number of issues in the last few days. May I ask where these are coming from? Are these flagged up by some kind of testing tool? Or are you encountering these in real-world code?
MarkLee131 commentedon Nov 10, 2026
Hi @jketema. Sorry for the late reply.
They come out of a research project on analyzer consistency. We collected the false-positive and false-negative issues that maintainers had confirmed on the trackers of several Java analyzers (SpotBugs, sonar-java, CodeQL's own), pulled out the recurring shapes behind them (a negated guard, a statement moved into a lambda, a parenthesised expression, a constant instead of a literal, that kind of thing), and checked which of the other analyzers have the same gap. The CodeQL issues are the cases where it does. Each one is a hand-minimised pair we ran through the CLI, and I checked the open issues before filing.
jketema commentedon Nov 10, 2026
@MarkLee131,
Thanks for your reply. Note that we generally tune our queries on real world code, so if there's no indication that these problems occur in practice, we're not going to prioritize fixing these.