Skip to content

Commit 6cf3308

Browse files
committed
chore(spdx-utils): Add types to SpdxSimpleLicenseMapping properties
Make these explicit for clarity. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 88015b4 commit 6cf3308

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

utils/spdx/src/main/kotlin/SpdxSimpleLicenseMapping.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ package org.ossreviewtoolkit.utils.spdx
2121

2222
import com.fasterxml.jackson.module.kotlin.readValue
2323

24+
import java.util.SortedMap
25+
2426
/**
2527
* A mapping from simple license names to valid SPDX license IDs. This mapping only contains license strings which *can*
2628
* be parsed by [SpdxExpression.parse] but have a corresponding valid SPDX license ID that should be used instead. See
@@ -30,23 +32,23 @@ object SpdxSimpleLicenseMapping {
3032
/**
3133
* The map of simple license names associated with their corresponding [SPDX license][SpdxLicense].
3234
*/
33-
internal val simpleLicenseMapping by lazy {
35+
internal val simpleLicenseMapping: Map<String, SpdxLicense> by lazy {
3436
val resource = checkNotNull(javaClass.getResource("/simple-license-mapping.yml"))
35-
yamlMapper.readValue<Map<String, SpdxLicense>>(resource)
37+
yamlMapper.readValue(resource)
3638
}
3739

3840
/**
3941
* The map of simple license names associated with their corresponding [SPDX expression][SpdxLicenseIdExpression].
4042
*/
41-
val simpleExpressionMapping by lazy {
43+
val simpleExpressionMapping: SortedMap<String, SpdxLicenseIdExpression> by lazy {
4244
simpleLicenseMapping.mapValuesTo(sortedMapOf(String.CASE_INSENSITIVE_ORDER)) { (_, v) -> v.toExpression() }
4345
}
4446

4547
/**
4648
* The map of deprecated SPDX license IDs associated with their current [SPDX expression]
4749
* [SpdxSingleLicenseExpression].
4850
*/
49-
val deprecatedExpressionMapping by lazy {
51+
val deprecatedExpressionMapping: SortedMap<String, SpdxSingleLicenseExpression> by lazy {
5052
val resource = checkNotNull(javaClass.getResource("/deprecated-license-mapping.yml"))
5153
val mapping = yamlMapper.readValue<Map<String, SpdxSingleLicenseExpression>>(resource)
5254
mapping.toSortedMap(String.CASE_INSENSITIVE_ORDER)

0 commit comments

Comments
 (0)