eclipse-jdt / eclipse-jdt/eclipse.jdt.ui
Clean up "Use Multi-catch" does not removed then unused imports
- Dominant language
- Java
- Stars
- 59
- Forks
- 127
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 35
Description
If one applies the clean-up "Use Multi-catch" to the following code snippets, the afterwards unused import for `IOException` is not removed:
```
package test;
import java.io.IOException;
public class Test {
public void m() {
try {
m1();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
private void m1() throws Exception {
}
}
```
Expected is the following code, but at the moment the import is not removed.
```
package test;
public class Test {
public void m() {
try {
m1();
} catch (Exception e) {
e.printStackTrace();
}
}
private void m1() throws Exception {
}
}
```
The example makes a bit more sense when the called method is defined in another Class and lists both `IOException` and `Exception` in its throws list.
Contributor guide
Research direction
Reproduce the issue using the Java snippets in the report and apply the “Use Multi-catch” cleanup. Compare the result with the expected code: the redundant catch should be removed and the now-unused IOException import should also disappear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100