Bug 567880

Summary: [cleanup] Use string literal for tests
Product: [Eclipse Project] JDT Reporter: Fabrice Tiercelin <fabrice.tiercelin>
Component: UIAssignee: Fabrice Tiercelin <fabrice.tiercelin>
Status: ASSIGNED --- QA Contact: Kenneth Styrberg <kenneth>
Severity: enhancement    
Priority: P3    
Version: 4.17   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/170785
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=0554db5338bdc6ea3e2e342472f5136c01291a7e
Whiteboard:

Description Fabrice Tiercelin CLA 2020-10-14 13:31:22 EDT
StringBuffer syntax is the oldschool style in the tests. The recent tests are written using simple string because it is optimized by the Java compiler so let's use the more readable syntax.
- A string literal concatenation is converted to a single string literal at compile time
- A dynamic string concatenation is converted to a StringBuilder at compile time
- A dynamic concatenation on several statement should be written using StringBuilder (not StringBuffer)
- StringBuffer is supposed to be used when you need a thread-safe builder, so actually: never :)