diff --git a/java/kotlin-extractor/src/main/kotlin/LinesOfCode.kt b/java/kotlin-extractor/src/main/kotlin/LinesOfCode.kt index 76f124c20f7..45e23498e9d 100644 --- a/java/kotlin-extractor/src/main/kotlin/LinesOfCode.kt +++ b/java/kotlin-extractor/src/main/kotlin/LinesOfCode.kt @@ -16,9 +16,8 @@ class LinesOfCode( val tw: FileTrapWriter, val file: IrFile ) { - val psi2Ir = getPsi2Ir(logger) - init { - if (psi2Ir == null) { + val psi2Ir = getPsi2Ir(logger).also { + if (it == null) { logger.warn("Lines of code will not be populated as Kotlin version is too old (${KotlinCompilerVersion.getVersion()})") } }