Deprecate sumBy and sumByDouble with WARNING

This commit is contained in:
Abduqodiri Qurbonzoda
2021-04-08 03:44:52 +03:00
parent 983985bc68
commit 33b44585c4
16 changed files with 203 additions and 4 deletions
@@ -221,6 +221,8 @@ object Aggregates : TemplateGroupBase() {
includeDefault()
include(CharSequences, ArraysOfUnsigned)
} builder {
deprecate(Deprecation("Use sumOf instead.", "this.sumOf(selector)", DeprecationLevel.WARNING, warningSince = "1.5"))
inline()
doc { "Returns the sum of all values produced by [selector] function applied to each ${f.element} in the ${f.collection}." }
returns("Int")
@@ -291,6 +293,8 @@ object Aggregates : TemplateGroupBase() {
includeDefault()
include(CharSequences, ArraysOfUnsigned)
} builder {
deprecate(Deprecation("Use sumOf instead.", "this.sumOf(selector)", DeprecationLevel.WARNING, warningSince = "1.5"))
inline()
specialFor(ArraysOfUnsigned) { inlineOnly() }
@@ -39,7 +39,7 @@ object Numeric : TemplateGroupBase() {
if (p == p.sumType())
"return storage.sum().to${p.sumType().name}()"
else
"return sumBy { it.to${p.sumType().name}() }"
"return sumOf { it.to${p.sumType().name}() }"
}
}
specialFor(Iterables, Sequences, ArraysOfObjects, ArraysOfPrimitives) {