diff --git a/docs/EvaluateRulesForKotlin.md b/docs/EvaluateRulesForKotlin.md index cdd90106..6a252554 100644 --- a/docs/EvaluateRulesForKotlin.md +++ b/docs/EvaluateRulesForKotlin.md @@ -9,14 +9,14 @@ Evaluation of Java PMD rules for use as Kotlin rules | 3. | PP-1 | AvoidDecimalAndChoiceFormatAsField | Yes? | Low | Yes | High | Not found | NumberFornat/DateFormat not included? | | 4. | | AvoidDuplicateAssignmentsInCases | Yes | Medium | Yes | Low/Medium | Partly found | Detekt:DuplicateCaseInWhenExpression has overlap but is not the same. Add example, doc, Questionable if occuring often. | | 5. | | AvoidImplicitlyRecompilingRegex | Yes | High | Yes | High | Not found | Kotlin has own String/regex, also occurs here? support both? | -| 6. | JB-1 | AvoidInMemoryStreamingDefaultConstructor | Yes | Low | Yes | High | Not found | Kotlin types? -> No | +| 6. | JB-1-PR | AvoidInMemoryStreamingDefaultConstructor | Yes | Low | Yes | High | Not found | Kotlin types? -> No | | 7. | | AvoidMultipleConcatStatements | Yes | Medium | Yes | High | Not found | How concat in Kotlin? Seems like Java | | 8. | PP-3 | AvoidRecompilingPatterns | Yes | Low/Medium | Yes | High | Not found | Kotlin version? | | 9. | JB-3 | AvoidRecompilingXPathExpression | Yes | Low | Yes | Medium/High | Not found | Good example ThreadLocal in Kotlin? | | 10. | | AvoidRecreatingDateTimeFormatter | Yes | Medium | Yes | High | Not found | - | | 11. | | AvoidReflectionInToStringAndHashCode | Yes | Low/Medium | Yes | Low/Medium | Not found | - | | 12. | PP-2 | AvoidSimpleDateFormat | Yes | Low | Yes | Medium | Not found | | -| 13. | JB-2 | AvoidStringBuffer | Yes | Low | Yes | Low/Medium | Not found | | +| 13. | JB-2-PR | AvoidStringBuffer | Yes | Low | Yes | Low/Medium | Not found | | | 14. | | AvoidUnconditionalBuiltLogStrings | Yes | High | Yes | Medium | Not found | | | 15. | | AvoidWideScopeXPathExpression | Yes | Low | Yes | Medium | Not found | | | 16. | | AvoidXPathAPIUsage | Yes | Low | Yes | Medium | Not found | remove VTD reference?, seems old, better alternatives? | diff --git a/rulesets/kotlin/jpinpoint-kotlin-rules.xml b/rulesets/kotlin/jpinpoint-kotlin-rules.xml index be9299e2..9cb2b441 100644 --- a/rulesets/kotlin/jpinpoint-kotlin-rules.xml +++ b/rulesets/kotlin/jpinpoint-kotlin-rules.xml @@ -57,6 +57,40 @@ class AvoidInMemoryStreamingDefaultConstructor { + + Problem: StringBuffer introduces locking overhead because it is thread safe. Its thread-safety is rarely needed. + Solution: Replace StringBuffer by StringBuilder. (jpinpoint-rules) + 3 + + + + + + + + + + + + + + + Problem: StringBuffer introduces locking overhead because it is thread safe. Its thread-safety is rarely needed. + Solution: Replace StringBuffer by StringBuilder. (jpinpoint-rules) + 3 + + + + + + + + + + + + diff --git a/src/test/resources/com/jpinpoint/perf/lang/kotlin/ruleset/common/xml/AvoidStringBuffer.xml b/src/test/resources/com/jpinpoint/perf/lang/kotlin/ruleset/common/xml/AvoidStringBuffer.xml new file mode 100644 index 00000000..42bc928b --- /dev/null +++ b/src/test/resources/com/jpinpoint/perf/lang/kotlin/ruleset/common/xml/AvoidStringBuffer.xml @@ -0,0 +1,23 @@ + + + + AvoidStringBuffer + 2 + 2,4 + + + + \ No newline at end of file