From 8f50cd32bc2b0d41a7029cd14ae7852ef277b53b Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Sat, 21 Jun 2025 18:22:42 +0300 Subject: [PATCH] fix: replace kotlin min() and max() deprecated functions with minOrNull() --- .../com/github/vlsi/gradle/license/api/LicenseExpression.kt | 4 ++-- .../github/vlsi/gradle/release/Apache2LicenseInterpreter.kt | 4 ++-- .../com/github/vlsi/gradle/release/StageVoteReleasePlugin.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseExpression.kt b/plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseExpression.kt index c4a455b2..7a20bb66 100644 --- a/plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseExpression.kt +++ b/plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle/license/api/LicenseExpression.kt @@ -160,7 +160,7 @@ fun LicenseExpression.weight(): Int = is JustLicense -> 1 is OrLaterLicense -> 2 is WithException -> license.weight() + 1 - is ConjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.max() ?: 1 - is DisjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.max() ?: 1 + is ConjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ?: 1 + is DisjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ?: 1 else -> TODO("Unexpected expression: ${this::class.simpleName}: $this") } diff --git a/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/Apache2LicenseInterpreter.kt b/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/Apache2LicenseInterpreter.kt index 5a5ce745..64b80f81 100644 --- a/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/Apache2LicenseInterpreter.kt +++ b/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/Apache2LicenseInterpreter.kt @@ -41,9 +41,9 @@ class Apache2LicenseInterpreter { return when (e) { is DisjunctionLicenseExpression -> // A or X => A - e.unordered.map { eval(it) }.min() + e.unordered.map { eval(it) }.minOrNull() is ConjunctionLicenseExpression -> - e.unordered.map { eval(it) }.max() + e.unordered.map { eval(it) }.maxOrNull() else -> null } ?: AsfLicenseCategory.UNKNOWN } diff --git a/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/StageVoteReleasePlugin.kt b/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/StageVoteReleasePlugin.kt index 5d849a66..0b8e2bf8 100644 --- a/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/StageVoteReleasePlugin.kt +++ b/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/StageVoteReleasePlugin.kt @@ -675,7 +675,7 @@ class StageVoteReleasePlugin @Inject constructor(private val instantiator: Insta Pair(listOf(), mapOf()) } - val svnStagingRevision = stagedFiles.map { it.commit.revision }.max() ?: 0 + val svnStagingRevision = stagedFiles.map { it.commit.revision }.maxOrNull() ?: 0 val releaseParams = ReleaseParams( tlp = releaseExt.tlp.get(),