-
Notifications
You must be signed in to change notification settings - Fork 1.2k
CoverageDateModelForInlining
Marc R. Hoffmann edited this page Aug 18, 2024
·
4 revisions
This page describes the additional requirements and possible solution approaches for JVM languages (in particular Kotlin) that allow inlining bytecode from one class into another class during compilation.
Functions can be designated to be inlined when used in the same or in another class:
inline fun inlineIntoExample() {
println("inline into example")
}
fun example() {
inlineIntoExample()
}
In this case the compiler inserts the bytecode complied for inlineIntoExample()
directly example()
instead of calling inlineIntoExample()
at runtime. Indeed the bytecode of inlineIntoExample()
will never be executed.
TODO: Describe structure of SMAP. What exactly is mapped?
- The user want to see the combined coverage of all usages of
inlineIntoExample()
in the coverage reports as if the method was actually called. - The user does not want to see coverage counters for inlined code at the call sites, otherwise the same code will be counted again for every call site.
The following assumptions of today's coverage model do not hold true any more with inlining:
- A single methods can have multiple sources (other methods, classes and source files).