Skip to content

Commit 0efd40b

Browse files
Upgraded Kotlin version to 1.5.21 and Gradle version to 7.1.1 (#416)
1 parent 6d0b318 commit 0efd40b

File tree

105 files changed

+444
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+444
-456
lines changed

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/dateFormat/Format.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Format(private val spec: List<SpecPart>) {
8383
Pattern.HOUR_12_LEADING_ZERO -> leadZero(getHours12(dateTime))
8484
Pattern.HOUR_24 -> leadZero(getHours24(dateTime))
8585
Pattern.MERIDIAN_LOWER -> getMeridian(dateTime)
86-
Pattern.MERIDIAN_UPPER -> getMeridian(dateTime).toUpperCase()
86+
Pattern.MERIDIAN_UPPER -> getMeridian(dateTime).uppercase()
8787
Pattern.DAY_OF_WEEK -> getWeekDayNumber(dateTime)
8888
Pattern.DAY_OF_WEEK_ABBR -> DateLocale.weekDayAbbr[dateTime.weekDay] ?: ""
8989
Pattern.DAY_OF_WEEK_FULL -> DateLocale.weekDayFull[dateTime.weekDay] ?: ""

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/enums/EnumInfoImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class EnumInfoImpl<EnumT : Enum<EnumT>>(enumConstants: Array<EnumT>) : EnumInfo<
1414
get() = myOriginalNames
1515

1616
private fun toNormalizedName(name: String): String {
17-
return name.toUpperCase()
17+
return name.uppercase()
1818
}
1919

2020
init {

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/json/JsonSupport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fun String.escape(): String {
6262
'\n' -> appendOutput("""\n""")
6363
'\r' -> appendOutput("""\r""")
6464
'\t' -> appendOutput("""\t""")
65-
in CONTROL_CHARS -> appendOutput("""\u${ch.toInt().toString(16).padStart(4, '0')}""")
65+
in CONTROL_CHARS -> appendOutput("""\u${ch.code.toString(16).padStart(4, '0')}""")
6666
else -> output?.append(ch)
6767
}
6868
i++

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/json/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fun <T : Enum<T>> parseEnum(enumStringValue: String, values: Array<T>): T =
3636
values.first { mode -> mode.toString().equals(enumStringValue, ignoreCase = true) }
3737

3838
inline fun <reified T : Enum<T>> parseEnum(enumStringValue: String): T = parseEnum(enumStringValue, enumValues<T>())
39-
fun <T : Enum<T>> formatEnum(enumValue: T): String = enumValue.toString().toLowerCase()
39+
fun <T : Enum<T>> formatEnum(enumValue: T): String = enumValue.toString().lowercase()
4040

4141
fun <T : Enum<T>> FluentObject.put(key: String, v: Collection<T>) = this.put(key, v.map { formatEnum(it) })
4242
fun FluentObject.put(key: String, v: List<String>) = put(key, FluentArray().addStrings(v.map { it }))

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/numberFormat/NumberFormat.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class NumberFormat(private val spec: Spec) {
8383
val (intStr, fracStr, exponentString) =
8484
"^(\\d+)\\.?(\\d+)?e?([+-]?\\d+)?\$"
8585
.toRegex()
86-
.find(num.toDouble().absoluteValue.toString().toLowerCase())
86+
.find(num.toDouble().absoluteValue.toString().lowercase())
8787
?.destructured
8888
?: error("Wrong number: $num")
8989

@@ -246,7 +246,7 @@ class NumberFormat(private val spec: Spec) {
246246
"g" -> toPrecisionFormat(numberInfo, spec.precision)
247247
"b" -> FormattedNumber(numberInfo.number.roundToLong().toString(2))
248248
"o" -> FormattedNumber(numberInfo.number.roundToLong().toString(8))
249-
"X" -> FormattedNumber(numberInfo.number.roundToLong().toString(16).toUpperCase())
249+
"X" -> FormattedNumber(numberInfo.number.roundToLong().toString(16).uppercase())
250250
"x" -> FormattedNumber(numberInfo.number.roundToLong().toString(16))
251251
"s" -> toSiFormat(numberInfo, spec.precision)
252252
else -> throw IllegalArgumentException("Wrong type: ${spec.type}")
@@ -417,7 +417,7 @@ class NumberFormat(private val spec: Spec) {
417417
private fun computePrefix(output: Output): Output {
418418
val prefix = when (spec.symbol) {
419419
"$" -> CURRENCY
420-
"#" -> if ("boxX".indexOf(spec.type) > -1) "0${spec.type.toLowerCase()}" else ""
420+
"#" -> if ("boxX".indexOf(spec.type) > -1) "0${spec.type.lowercase()}" else ""
421421
else -> ""
422422
}
423423
return output.copy(prefix = prefix)

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/spatial/GeoBoundingBoxCalculator.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
package jetbrains.datalore.base.spatial
77

8-
import jetbrains.datalore.base.gcommon.base.Preconditions
98
import jetbrains.datalore.base.gcommon.collect.ClosedRange
109
import jetbrains.datalore.base.spatial.LongitudeSegment.Companion.splitSegment
1110
import jetbrains.datalore.base.typedGeometry.*
@@ -14,8 +13,9 @@ import kotlin.math.min
1413

1514
// Segment have direction, i.e. `start` can be less than `end` for the case
1615
// of the antimeridian intersection.
17-
// Thats why we can't use ClosedRange class with lower <= upper invariant
16+
// That's why we can't use ClosedRange class with lower <= upper invariant
1817
typealias Segment = Pair<Double, Double>
18+
1919
val Segment.start get() = first
2020
val Segment.end get() = second
2121

@@ -64,7 +64,10 @@ class GeoBoundingBoxCalculator<TypeT>(
6464
}
6565

6666
companion object {
67-
internal fun calculateLoopLimitRange(segments: Sequence<Segment>, mapRange: ClosedRange<Double>): ClosedRange<Double> {
67+
internal fun calculateLoopLimitRange(
68+
segments: Sequence<Segment>,
69+
mapRange: ClosedRange<Double>
70+
): ClosedRange<Double> {
6871
return segments
6972
.map {
7073
splitSegment(
@@ -152,7 +155,7 @@ fun <T> GeoBoundingBoxCalculator<T>.geoRectsBBox(rectangles: List<GeoRectangle>)
152155
}
153156

154157
fun <T> GeoBoundingBoxCalculator<T>.pointsBBox(xyCoords: List<Double>): Rect<T> {
155-
Preconditions.checkArgument(xyCoords.size % 2 == 0, "Longitude-Latitude list is not even-numbered.")
158+
require(xyCoords.size % 2 == 0) { "Longitude-Latitude list is not even-numbered." }
156159
val x: (Int) -> Double = { index -> xyCoords[2 * index] }
157160
val y: (Int) -> Double = { index -> xyCoords[2 * index + 1] }
158161

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/stringFormat/StringFormat.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class StringFormat private constructor(
8787
// "{{text}}" -> "{text}"
8888
// "{.1f} -> 1.2
8989
// "{{{.1f}}} -> {1.2}
90-
private val BRACES_REGEX = Regex("""(?![^{]|\{\{)(\{([^{}]*)})(?=[^}]|}}|$)""")
90+
private val BRACES_REGEX = Regex("""(?![^{]|\{\{)(\{([^{}]*)\})(?=[^}]|\}\}|$)""")
9191
const val TEXT_IN_BRACES = 2
9292

9393
fun valueInLinePattern() = "{}"

base-portable/src/commonMain/kotlin/jetbrains/datalore/base/values/Colors.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ object Colors {
6565
}
6666

6767
fun isColorName(colorName: String): Boolean {
68-
return namedColors.containsKey(colorName.toLowerCase())
68+
return namedColors.containsKey(colorName.lowercase())
6969
}
7070

7171
fun forName(colorName: String): Color {
72-
return namedColors[colorName.toLowerCase()] ?: throw IllegalArgumentException()
72+
return namedColors[colorName.lowercase()] ?: throw IllegalArgumentException()
7373
}
7474

7575
fun generateHueColor(): Double {

base-portable/src/commonTest/kotlin/jetbrains/datalore/base/numberFormat/NumberFormatExtremesTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class NumberFormatExtremesTest {
1313
fun typeS() {
1414
val f = NumberFormat(".3s")
1515
assertEquals("0.00y", f.apply(Double.MIN_VALUE))
16-
assertEquals("1000000000000000Y", f.apply(1E39))
16+
assertEquals("100000000000000Y", f.apply(1E38))
1717
assertEquals("0.00y", f.apply(-Double.MIN_VALUE))
18-
assertEquals("-1000000000000000Y", f.apply(-1E39))
18+
assertEquals("-100000000000000Y", f.apply(-1E38))
1919

2020
assertEquals("100Y", f.apply(NumberFormat.TYPE_S_MAX))
2121
assertEquals("-100Y", f.apply(-NumberFormat.TYPE_S_MAX))

base/src/jsMain/kotlin/jetbrains/datalore/base/encoding/Base64.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import kotlinx.browser.window
1010
actual object Base64 {
1111
actual fun decode(s: String): ByteArray {
1212
val bin = window.atob(s)
13-
return ByteArray(bin.length) { i -> bin[i].toByte()}
13+
return ByteArray(bin.length) { i -> bin[i].code.toByte() }
1414
}
1515

1616
actual fun encode(data: ByteArray): String {
17-
val binStr = data.fold(StringBuilder()) { str, byte -> str.append(byte.toChar()) }.toString()
17+
val binStr = data.fold(StringBuilder()) { str, byte -> str.append(byte.toInt().toChar()) }.toString()
1818
return window.btoa(binStr)
1919
}
2020
}

0 commit comments

Comments
 (0)