Skip to content

Commit b3794f3

Browse files
committed
chore: Resolve Compiler Warning
Resolves the following warning: Using 'getter for first: E!' is an error. 'getFirst()' member of List is redundant in Kotlin and might be removed soon. Please use 'first()' stdlib extension instead. The snippet itself is not using "getFirst" or "first" but the correctly stated "first()" method. Therefore it seems to be a false positive.
1 parent c2a09e7 commit b3794f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kuksa-java-sdk/src/main/kotlin/org/eclipse/kuksa/extension/vss/VssNodeCopyExtension.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023 - 2025 Contributors to the Eclipse Foundation
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*
1616
* SPDX-License-Identifier: Apache-2.0
17+
*
1718
*/
1819

1920
package org.eclipse.kuksa.extension.vss
@@ -57,7 +58,8 @@ fun <T : VssNode> T.deepCopy(generation: Int = 0, changedHeritage: List<VssNode>
5758
// Create the missing link between this [VssNode] and the given node inbetween
5859
var heritageLine = changedHeritage
5960
if (changedHeritage.size == 1) {
60-
heritageLine = findHeritageLine(changedHeritage.first(), true)
61+
val heir = changedHeritage.firstOrNull()!! // safe cast to non-null because size == 1
62+
heritageLine = findHeritageLine(heir, true)
6163
.toList()
6264
.ifEmpty { changedHeritage }
6365
}

0 commit comments

Comments
 (0)