Minor, make BinaryVersion.numbers private
Use BinaryVersion.toArray instead, as in all other usages
This commit is contained in:
@@ -14,7 +14,7 @@ package org.jetbrains.kotlin.metadata.deserialization
|
|||||||
* - Patch version can be increased freely and is only supposed to be used for debugging. Increase the patch version when you
|
* - Patch version can be increased freely and is only supposed to be used for debugging. Increase the patch version when you
|
||||||
* make a change to binaries which is both forward- and backward compatible.
|
* make a change to binaries which is both forward- and backward compatible.
|
||||||
*/
|
*/
|
||||||
abstract class BinaryVersion(vararg val numbers: Int) {
|
abstract class BinaryVersion(private vararg val numbers: Int) {
|
||||||
val major: Int = numbers.getOrNull(0) ?: UNKNOWN
|
val major: Int = numbers.getOrNull(0) ?: UNKNOWN
|
||||||
val minor: Int = numbers.getOrNull(1) ?: UNKNOWN
|
val minor: Int = numbers.getOrNull(1) ?: UNKNOWN
|
||||||
val patch: Int = numbers.getOrNull(2) ?: UNKNOWN
|
val patch: Int = numbers.getOrNull(2) ?: UNKNOWN
|
||||||
|
|||||||
+5
-3
@@ -345,9 +345,11 @@ fun EditorNotificationPanel.createComponentActionLabel(labelText: String, callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
private operator fun BinaryVersion.compareTo(other: BinaryVersion): Int {
|
private operator fun BinaryVersion.compareTo(other: BinaryVersion): Int {
|
||||||
for (i in 0..Math.max(numbers.size, other.numbers.size) - 1) {
|
val first = this.toArray()
|
||||||
val thisPart = numbers.getOrNull(i) ?: -1
|
val second = other.toArray()
|
||||||
val otherPart = other.numbers.getOrNull(i) ?: -1
|
for (i in 0 until maxOf(first.size, second.size)) {
|
||||||
|
val thisPart = first.getOrNull(i) ?: -1
|
||||||
|
val otherPart = second.getOrNull(i) ?: -1
|
||||||
|
|
||||||
if (thisPart != otherPart) {
|
if (thisPart != otherPart) {
|
||||||
return thisPart - otherPart
|
return thisPart - otherPart
|
||||||
|
|||||||
Reference in New Issue
Block a user