Vitali Plagov
12/14/2022, 3:31 PMfirst {}
function fails with the NoSuchElementException
and the stacktrace the IDEA is showing is pointing to a line number that doesn’t exist in the file. I.e., there are 150 lines of code in the file, but stacktrace is pointing to something like MyClass.kt:245
mkrussel
12/14/2022, 3:43 PMfirst
.Alan B
12/15/2022, 5:23 PMAlan B
12/15/2022, 7:57 PMVitali Plagov
12/16/2022, 1:18 PMAlan B
12/16/2022, 1:24 PMAlan B
12/16/2022, 1:26 PMVitali Plagov
12/18/2022, 12:08 PMAlan B
12/19/2022, 1:25 PMprivate inline fun filter(x: String): Boolean = throw UnknownError()
fun main() {
listOf("a").filter(::filter)
}
Will print out:
Exception in thread "main" java.lang.UnknownError
at InlineThrowKt.main(InlineThrow.kt:7)
at InlineThrowKt.main(InlineThrow.kt)
And we know there is no line 7. But the IDE usually does this with the option to click the odd line number which gives an option:Alan B
12/19/2022, 1:25 PMAlan B
12/19/2022, 1:31 PMAlan B
12/19/2022, 1:32 PM