Hi Sonarqube Team,
The code below seems to contain the bug described in RSPEC-6417, however, the bug was not being detected during the scan. Any thoughts?
import java.util.ArrayList;
import java.util.List;
class Main {
public static void main(String[] args) {
List<String> lst = new ArrayList<>();
lst.add("xhello");
lst.add("world");
showBug(lst);
}
public static void showBug(List<String> lst) {
for (String element : lst) {
if (element.startsWith("x")) {
lst.remove(element);
}
}
}
}
Sonarqube version 25.5
Lang: Java
SonarScanner version: 5.0.1.3006
Screenshot of code scan results

