Drop redundant safe calls on smart-cast morphoData in Krill layer scan
Inside `if (hasExtra)` the compiler already smart-casts `morphoData` to
non-null (hasExtra can only be true when `morphoData?.any{}` returned true),
so the per-attribute `morphoData?.any{ } == true` checks raised "unnecessary
safe call on a non-null receiver" warnings. Use the non-null form.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: Ib5247e8b3ad04c9235f62a51b52949ce698151f8
diff --git a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/formatters/KrillJsonGenerator.kt b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/formatters/KrillJsonGenerator.kt
index 76c6459..a7540c0 100644
--- a/app/src/main/kotlin/de/ids_mannheim/korapxmltools/formatters/KrillJsonGenerator.kt
+++ b/app/src/main/kotlin/de/ids_mannheim/korapxmltools/formatters/KrillJsonGenerator.kt
@@ -368,10 +368,12 @@
(it.phon != null && it.phon != "_") || (it.trans != null && it.trans != "_")
} ?: false
if (hasExtra) {
- if (morphoData?.any { it.norm != null && it.norm != "_" } == true) layers.add("norm=tokens")
- if (morphoData?.any { it.orig != null && it.orig != "_" } == true) layers.add("orig=tokens")
- if (morphoData?.any { it.phon != null && it.phon != "_" } == true) layers.add("phon=tokens")
- if (morphoData?.any { it.trans != null && it.trans != "_" } == true) layers.add("trans=tokens")
+ // hasExtra is only true when morphoData is non-null, so the
+ // compiler smart-casts it here (no safe call needed).
+ if (morphoData.any { it.norm != null && it.norm != "_" }) layers.add("norm=tokens")
+ if (morphoData.any { it.orig != null && it.orig != "_" }) layers.add("orig=tokens")
+ if (morphoData.any { it.phon != null && it.phon != "_" }) layers.add("phon=tokens")
+ if (morphoData.any { it.trans != null && it.trans != "_" }) layers.add("trans=tokens")
}
}
}