| Summary: | [inline] inline string variable should avoid string concatenation | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Nikolay Metchev <nikolaymetchev> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | markus.kell.r |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I agree that this could be handy sometimes, but we want to keep refactorings targeted to perform a single action (avoid guessing and being too smart, since it's not always clear that the user really wants/needs the additional smartness). A decent compiler already concatenates the resulting "b" + "1" + "c" + "1" into one string, so this is also not a performance concern. What we could do though, is add a quick fix that concatenates sequences of string literals into one, i.e. "b" + "1" + "c" + "1" => "b1c1", see bug 77632. |
When you inline the variable a in the snippet below it would be very good if eclipse remove the concatenation code: ==== INPUT ===== String a = "1"; String n = "b" + a + "c" + a; ================ ==== OUTPUT ==== String n = "b1c1"; ================