Bug 567880 - [cleanup] Use string literal for tests
Summary: [cleanup] Use string literal for tests
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.17   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Fabrice Tiercelin CLA
QA Contact: Kenneth Styrberg CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-14 13:31 EDT by Fabrice Tiercelin CLA
Modified: 2020-10-15 01:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 :)