| Summary: | Suggest use of StringBuilder instead of StringBuffer where appropriate | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Alex Blewitt <alex.blewitt> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | daniel_megert |
| Version: | 3.3 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
*** This bug has been marked as a duplicate of bug 128020 *** |
Build Identifier: 3.7 Code that is of the form: public String foo() { StringBuffer buffer = new StringBuffer(); buffer.append("stuff"); return buffer.toString() } can be promoted to StringBuilder (if the compiler compliance is >= 1.5) without any loss of function. An informational/warning dialog noting the construction and destruction of a StringBuffer inside a single method (i.e. does not escape through field, inner class binding etc.) is guaranteed to be handled by a single thread and so can use the StringBuilder which doesn't have synchronized semantics. Reproducible: Always