This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 230240 - Fix code feature request: convert string concat to MessageFormat
Summary: Fix code feature request: convert string concat to MessageFormat
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: Macintosh Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-24 15:08 UTC by exolon
Modified: 2013-09-02 14:22 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description exolon 2013-05-24 15:08:35 UTC
Hi,

I used the "insert code" command to generate a toString() method for a class with a lot of data members.
The result was a series of string concatenations ("productId: " + productId + ", stockQuantity: " + stockQuantity + ... etc etc ...) on a single line which is now 1093 characters long (which the built-in reformatter doesn't split onto multiple lines).

A nice context-sensitive refactoring provided in Eclipse is the ability to automatically convert a series of string concatenations like this into either a StringBuilder append sequence or a single MessageFormat printf-like statement. Not necessarily for efficiency in this case (the JVM tries to cheat by using a StringBuilder internally, to avoid taking n^2 time for n string concatenations), but just so it doesn't look so bad and take as much space onscreen.

Could we get these refactorings in Netbeans?