output of javap
public static final void foo(java.io.InputStream);
descriptor: (Ljava/io/InputStream;)V
flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
Code:
stack=4, locals=8, args_size=1
0: aload_0
1: ldc #9 // String inputStream
3: invokestatic #15 // Method kotlin/jvm/internal/Intrinsics.checkParameterIsNotNull:(Ljava/lang/Object;Ljava/lang/String;)V
6: aload_0
7: astore_2
8: getstatic #21 // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
11: astore_3
12: iconst_0
13: istore 4
15: aload_2
16: astore 5
18: iconst_0
19: istore 6
21: new #23 // class java/io/InputStreamReader
24: dup
25: aload 5
27: aload_3
28: invokespecial #27 // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
31: checkcast #29 // class java/io/Reader
34: astore 5
36: sipush 8192
39: istore 6
41: iconst_0
42: istore 7
44: aload 5
46: instanceof #31 // class java/io/BufferedReader
49: ifeq 60
52: aload 5
54: checkcast #31 // class java/io/BufferedReader
57: goto 71
60: new #31 // class java/io/BufferedReader
63: dup
64: aload 5
66: iload 6
68: invokespecial #34 // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
71: astore_1
72: return
clearly shows that there is a branch - see offsets 46 and 49 above.
Compilation of
fun foo(inputStream: java.io.InputStream) {
val temp = inputStream.reader(); val x = if (temp is java.io.BufferedReader) temp else java.io.BufferedReader(temp, DEFAULT_BUFFER_SIZE)
}
produces almost the same bytecode.
AFAIK there are no markers in bytecode to realize that kotlin.internal.InlineOnly function was inlined.
So there is no way for JaCoCo to distinguish whether bytecode was produced from source code as in the first example or as in second.