| Summary: | [clean up][quick assist] Remove unused local variables leaves cast (compile error) | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Sebastian.Buchwald |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert, dvice_null, markus.kell.r, phoen1x |
| Version: | 3.4.1 | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
You indicated in comment 0 that you are using M20080911-1700, which is 3.4.1, so please stop changing the version. This bug still reproduce in 20090920-1017 (3.5.1) Map insertMap = new LinkedHashMap(); This code after clean-up set to new LinkedHashMap(); But if i use qiuck fix (Ctrl-1), a have choose beetwen 2 type of remove this variable I need can set this option in clen-up settings. (In reply to comment #2) We're not going to offer the other quick assist as clean up, since it does not always preserve behavior. (In reply to comment #3) I'm sorry, you didn't understand me. I meant that in my opinion it is not correct that clean-up function always uses option which transfers this kind of code: Map insertMap = new LinkedHashMap(); to -> new LinkedHashMap(); while when I use quick fix it offers me two oppotunities of remove-action (total removing or transformation to the form mentioned before). So I'd like to have some option in clen-up settings where I could choose the type of result I expect this line will have after conversion. (In reply to comment #4) I did understand your request, but that's not the subject of this bug. You would have to open a new enhancement request for comment 2, but as I said, we're not going to add that, so if you open an enhancement request, it will be closed as WONTFIX. *** Bug 374083 has been marked as a duplicate of this bug. *** This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build ID: M20080911-1700 Steps To Reproduce: 1. Create a new "Bug" class (see attachment): import java.util.HashSet; import java.util.Set; public class Bug { public static void main(String[] args) { Set bla = null; bla = (Set)new HashSet(); } } 2. Source -> Clean up 3. Use a profile with "Remove unused local variables" activated More information: The code should looks like import java.util.HashSet; import java.util.Set; public class Bug { public static void main(String[] args) { (Set)new HashSet(); } } which isn't valid java code. If you remove the "(Set)"-cast the code will be valid.