Inspection Idea

I've recently come across code like this:

StringBuffer buf = new StringBuffer(str);
buf.append("Some text" + foo(i, bar) + ", ");

wtf?! I thought. Then when I'd calmed down a bit, I thought it would be
nice if IG somehow reported specifically string concatenation within a
call to StringBuffer.append(), and provided me with a quick fix to break
out this statement into a chained append() statement, eg:

buf.append("Some text").append(foo(i, bar)).append(", ");

Say the word and I'll submit an SCR.

Cheers,
N.

0
6 comments
Avatar
Permanently deleted user

word

0
Avatar
Permanently deleted user

and

Stephen Kelvin wrote:

word

0
Avatar
Permanently deleted user

Reasonable. Note however that there is already an intention that will do this conversion, so if you see such code the fix is pretty easy. Do submit a change request, but don't expect it before the Irida release, as IG and IPP are going into feature-freeze.

--Dave Griffith

0
Avatar
Permanently deleted user

Dave Griffith wrote:

Reasonable. Note however that there is already an intention that will do this conversion, so if you see such code the fix is pretty easy. Do submit a change request, but don't expect it before the Irida release, as IG and IPP are going into feature-freeze.

--Dave Griffith

Great, didn't realise that intention was there, thanks.

http://www.jetbrains.net/jira/browse/IDEA-3031

N.

0
Avatar
Permanently deleted user

I lied. I got bored with chasing bugs, and let myself have a half-hour on this one. It'll be in the next EAP release.

--Dave Griffith

0
Avatar
Permanently deleted user

Dave Griffith wrote:

I lied. I got bored with chasing bugs, and let myself have a half-hour on this one. It'll be in the next EAP release.

--Dave Griffith

I noticed ;)

Cheers Dave!
N.

0

Please sign in to leave a comment.