From 34420fd459dce8acb1e4a8283a633f51c759b018 Mon Sep 17 00:00:00 2001 From: Jens Keim Date: Thu, 31 Oct 2024 13:38:03 +0100 Subject: [PATCH] refactor: Update `as KnownProvenance` casts In some instances, the casting to `KnownProvenance` is not explicitly required by receiving functions, here a more strict casting to `RemoteProvenance` is cleaner. Signed-off-by: Jens Keim --- helper-cli/src/main/kotlin/utils/Extensions.kt | 4 ++-- model/src/main/kotlin/ScannerRun.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helper-cli/src/main/kotlin/utils/Extensions.kt b/helper-cli/src/main/kotlin/utils/Extensions.kt index 4bc6ecfa5e027..1c4920ed897f2 100644 --- a/helper-cli/src/main/kotlin/utils/Extensions.kt +++ b/helper-cli/src/main/kotlin/utils/Extensions.kt @@ -219,8 +219,8 @@ internal fun OrtResult.getViolatedRulesByLicense( /** * Return the [Provenance] of the first scan result matching the given [id] or null if there is no match. */ -internal fun OrtResult.getScannedProvenance(id: Identifier): KnownProvenance? = - getScanResultsForId(id).firstNotNullOfOrNull { it.provenance as? KnownProvenance } +internal fun OrtResult.getScannedProvenance(id: Identifier): RemoteProvenance? = + getScanResultsForId(id).firstNotNullOfOrNull { it.provenance as? RemoteProvenance } /** * Return the [SourceCodeOrigin] for this provenance. diff --git a/model/src/main/kotlin/ScannerRun.kt b/model/src/main/kotlin/ScannerRun.kt index 17236c0d37724..ed51b34b20fe0 100644 --- a/model/src/main/kotlin/ScannerRun.kt +++ b/model/src/main/kotlin/ScannerRun.kt @@ -167,8 +167,8 @@ data class ScannerRun( provenances.associateBy { it.id } } - private val scanResultsByProvenance: Map> by lazy { - scanResults.groupBy { it.provenance as KnownProvenance } + private val scanResultsByProvenance: Map> by lazy { + scanResults.groupBy { it.provenance as RemoteProvenance } } private val scanResultsById: Map> by lazy {