Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » StringBuffer Quick Assist
StringBuffer Quick Assist [message #250266] Tue, 18 December 2007 22:05 Go to next message
Eclipse UserFriend
Originally posted by: mthibberd.gmail.com

I was browsing through the Eclipse 3.4 M4 News
( http://download.eclipse.org/eclipse/downloads/drops/S-3.4M4- 200712131700/eclipse-news-M4.html)
and come across this disturbing little feature: 'Convert to StringBuffer'
quick assist.

Just wondering if anyone knows why it was added, and can it be removed.
There are enough problems with dodgy code without having to worry about
eclipse offering to make it dodgier.

Basically, There is something which already does this - it is called a
compiler - and it does a much better job. For example if you convert string
concatenation to StringBuffer calls on JDK 5+ your code will actually
be SLOWER. This is due to the fact that the JDK 5+ code knows about
StringBuilder (basically non-synchronized StringBuffer - specifically
for these localized examples).

Enough with the Java optimization myths, if you have 'heard' something is
'meant' to be faster, it probably isn't.
Re: StringBuffer Quick Assist [message #250270 is a reply to message #250266] Tue, 18 December 2007 22:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wharley.bea.com

"Mark Hibberd" <mthibberd@gmail.com> wrote in message
news:de49c5d6a0bb9484b467954a6447dff7$1@www.eclipse.org...
>I was browsing through the Eclipse 3.4 M4 News
>( http://download.eclipse.org/eclipse/downloads/drops/S-3.4M4- 200712131700/eclipse-news-M4.html)
>and come across this disturbing little feature: 'Convert to StringBuffer'
>quick assist.
>
> Just wondering if anyone knows why it was added, and can it be removed.

A quick search of Bugzilla reveals that your question and concerns have
already been given some thought - in this case, at least four years of
thought. See, e.g., https://bugs.eclipse.org/bugs/show_bug.cgi?id=36350#c22
.. You may or may not agree with the conclusion, but that's a starting point
for you to answer your question, and a forum in which to address it.

Being as how roughly the same team of people work on the JDT UI as work on
the Java compiler itself, they've got a pretty good idea of how Java
behaves. I've in general found it useful to start from a stance of "how did
smart and well-informed people come to disagree with me," as opposed to
"gee, what braindead bozos." Not to put words in your mouth :-)
Re: StringBuffer Quick Assist [message #250286 is a reply to message #250266] Wed, 19 December 2007 13:01 Go to previous messageGo to next message
Jerome Lanneluc is currently offline Jerome LannelucFriend
Messages: 572
Registered: July 2009
Senior Member
Mark Hibberd wrote:
> I was browsing through the Eclipse 3.4 M4 News
> ( http://download.eclipse.org/eclipse/downloads/drops/S-3.4M4- 200712131700/eclipse-news-M4.html)
> and come across this disturbing little feature: 'Convert to
> StringBuffer' quick assist.
>
> Just wondering if anyone knows why it was added, and can it be removed.
> There are enough problems with dodgy code without having to worry about
> eclipse offering to make it dodgier.
>
> Basically, There is something which already does this - it is called a
> compiler - and it does a much better job. For example if you convert string
> concatenation to StringBuffer calls on JDK 5+ your code will actually
> be SLOWER. This is due to the fact that the JDK 5+ code knows about
> StringBuilder (basically non-synchronized StringBuffer - specifically
> for these localized examples).
>
> Enough with the Java optimization myths, if you have 'heard' something
> is 'meant' to be faster, it probably isn't.
>
Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213157
Re: StringBuffer Quick Assist [message #250290 is a reply to message #250286] Wed, 19 December 2007 16:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Jerome Lanneluc wrote:
> Mark Hibberd wrote:
>> I was browsing through the Eclipse 3.4 M4 News
>> ( http://download.eclipse.org/eclipse/downloads/drops/S-3.4M4- 200712131700/eclipse-news-M4.html)
>> and come across this disturbing little feature: 'Convert to
>> StringBuffer' quick assist.
>>
>> Just wondering if anyone knows why it was added, and can it be
>> removed. There are enough problems with dodgy code without having to
>> worry about eclipse offering to make it dodgier.
>>
>> Basically, There is something which already does this - it is called a
>> compiler - and it does a much better job. For example if you convert
>> string
>> concatenation to StringBuffer calls on JDK 5+ your code will actually
>> be SLOWER. This is due to the fact that the JDK 5+ code knows about
>> StringBuilder (basically non-synchronized StringBuffer - specifically
>> for these localized examples).
>>
>> Enough with the Java optimization myths, if you have 'heard' something
>> is 'meant' to be faster, it probably isn't.
>>
> Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213157

I read that bug and the original request for the quick fix,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=36350
It seems to me that the point of this thread is made in those bugs but
never really addressed. That point is whether or nor Eclipse should be
providing Quick Assists that may be considered not-so-best practices,
things that used to be good recommendations but are not longer so.In
other words, shouldn't JDT look to eliminate features (in particular
quick fixes and refactorings) that are no longer useful given language,
compiler, and JVM improvements? Otherwise the quick fix and refactoring
libraries will fill up with cruft over time.

Eric
Re: StringBuffer Quick Assist [message #250294 is a reply to message #250290] Wed, 19 December 2007 17:21 Go to previous message
Eclipse UserFriend
Originally posted by: aeschli.acm.org

The quick assist request has been there for a long time and has now been
contributed by an external contributer. From that, and from my own
experience, I assume it is wanted.

We will fix it is to use StringBuilder instead of StringBuffer on source
level >= 1.5 and with that I don't think it's bad practice to use that
quick assist.
Previous Topic:problem with content assistant
Next Topic:How can I set [order and export] property of class entry?
Goto Forum:
  


Current Time: Sat Nov 09 05:11:05 GMT 2024

Powered by FUDForum. Page generated in 0.03185 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top