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.
Please sign in to leave a comment.
word
and
Stephen Kelvin 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
Dave Griffith wrote:
Great, didn't realise that intention was there, thanks.
http://www.jetbrains.net/jira/browse/IDEA-3031
N.
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
Dave Griffith wrote:
I noticed ;)
Cheers Dave!
N.