Should ignore kotlin.KotlinNothingValueException
throwing code, that is generated code (by Kotlin compiler)
#1589
Labels
kotlin.KotlinNothingValueException
throwing code, that is generated code (by Kotlin compiler)
#1589
Scenario
Nothing
return typefun throwSomeException(): Nothing { throw RuntimeException("this method never returns and always throws") }
it never returns (always throws an exception)
, and Kotlin compiler ensure the method always throwsExample:
Current Behaviour
For every code lines calling Kotlin
Nothing
returning method, JaCoCo reports "1 or 2 branch missed".This looks caused by Kotlin compiler generated safety-guard code, that throws
kotlin.KotlinNothingValueException
in case of if theNothing
returning method haven't thrown exception.As looking JVM bytecode of the caller-side, the bytecode looks like this:
The
NEW kotlin/KotlinNothingValueException
and following code lines never runs practically because the codes followsNothing
returning method call that always throws exception.Wanted Behaviour
For every code lines calling Kotlin
Nothing
returning method, JaCoCo should ignorekotlin.KotlinNothingValueException
related compiler-generated codes.Possible Workarounds
The text was updated successfully, but these errors were encountered: