[java] New Performance Rule AvoidConcatInLoop#2575
Conversation
Including unit tests and examples. Originating from github.com/jborgers/PMD-jPinpoint-rules. Links to more doc later.
ss suggested by oowekyala.
…oop and String field.
|
This rule shares the same justification as InefficientStringBuffering (like the other rule AvoidConcatInAppend in #1932). Maybe these should be merged? |
In InefficientStringBuffering, you already use StringBuilder/Buffer, but not efficiently. In AvoidConcatInLoop you don't use StringBuilder yet, just ordinary string concats. But special case: in a loop. We have another rule UseStringBufferForStringAppends where this one would fit... It would be then a false-negative, if UseStringBufferForStringAppends wouldn't detect string appends (aka concats) inside loops... |
|
Most cases were indeed already handled by the existing rule, so closing this PR in favor of #2600. |
Describe the PR
This is the rule "AvoidConcatInLoop" split from original PR #1932 .
Related issues
Ready?
(//A | //B)//Csomehow only returns nodes of type A or B, but misses the C part... That's why this PR is WIP../mvnw clean verifypasses (checked automatically by travis)