Why are there no option `Safe Delete` for unused local var in `unused declaration` inspection

to unused method,there is option `Safe Delete`

but to unused local var,there is only one option

i need to click one by one to clean up unused local var,not like unused method could safe delete in batches

评论操作 固定链接

which version of IDEA do you use? works fine for me on 2021.3.3 and 2022.1

评论操作 固定链接

IntelliJ IDEA 2022.1 (Ultimate Edition)

评论操作 固定链接

Could you please provide a code sample with which we can reproduce the issue? With just an unused List it works fine for me, so maybe there's smth else to take into account

评论操作 固定链接

It should have no realation to do with the code.ALL unused local var could not be safe deleted directly

protected List parseResponse(String ruleName, String returnSOAPMessage) throws ApplicationException {
try (StringReader sr = new StringReader(returnSOAPMessage)) {
InputSource is = new InputSource(sr);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
Document doc = dbf.newDocumentBuilder().parse(is);
NodeList rsNodeList = doc.getElementsByTagName(ruleName);
if ((rsNodeList != null) && (rsNodeList.getLength() > 0)) {
return recurseParser(rsNodeList);
} else {
String msg = getElementsByName(doc, "ds:exception");
String faultcode = getElementsByName(doc, "faultcode");
String faultstring = getElementsByName(doc, "faultstring");
ApplicationException ume = new ApplicationException("A0004025");
throw ume;
} catch (SAXException | IOException | ParserConfigurationException e) {
throw new ApplicationException("A0004025", e);
评论操作 固定链接

we were able to reproduce the issue, you can follow it here: https://youtrack.jetbrains.com/issue/IDEA-293851