Comments (5)
I see, thanks for the response! For future reference, I think Kotlin/kotlinx.coroutines#3911 will be the main report going forward.
from jacoco.
🎉 here is reproducer that doesn't require coroutines library
src/a/A.kt
package a;
@Suppress("UNUSED_PARAMETER")
public fun a0(p: suspend () -> Unit) {
}
public inline fun a(crossinline p: suspend () -> Unit) = a0 { p() }
src/b/B.kt
package b;
fun b() {
a.a { }
}
their separate compilation
kotlin-compiler-1.9.10/bin/kotlinc -d classes src/a
kotlin-compiler-1.9.10/bin/kotlinc -d classes -cp classes src/b
find classes -name "*.class" -print0 | xargs -0 javap -v -p | grep "line 0"
leads to zero line numbers
line 0: 3
line 0: 44
from jacoco.
Hi @dzirbel, thanks for the detailed bug report!
JaCoCo runs on Java classfiles and uses the contained debug information to extract line numbers. The line numbers are inserted by the respective compiler. It is a known issue that the Kotlin compiler sometimes emits line number 0. Please report this to the Kotlin project.
So why don't you see line number 0 in older versions? Because this was a bug in ASM (https://gitlab.ow2.org/asm/asm/-/issues/317989) which has been fixed.
from jacoco.
For the record: some time ago I did bisection of changes in Kotlin compiler (see #1471 (comment)), which unfortunately revealed change in the coroutines library (JetBrains/kotlin@a1b04a7) and not in the compiler. Unfortunately wasn't able to craft reproducer that doesn't rely on coroutines library. And unfortunately did not managed to bisect changes in the coroutines library, because was unable to build its older versions due to massive rework of external dependencies and repositories.
CC @qwwdfsad
from jacoco.
And to me seems that this is a compiler bug that was introduced during a switch to IR-based back-end:
support for crossinline suspend lambdas was added in Kotlin compiler version 1.4.0
- see JetBrains/kotlin@a1448eb
and for the above reproducer https://github.com/JetBrains/kotlin/releases/tag/v1.4-M1 produces zero line numbers only with -Xuse-ir
option
from jacoco.
Related Issues (20)
- Aspect method invoking chain doesn't have right coverage data HOT 3
- Send Jacoco coverage file to S3 Bucket without stopping JVM from AWS Lambda HOT 1
- Kotlin companion object variables being covered as methods
- Data class with >32 properties shows missing branch coverage
- Jacoco 0.8.11 not working for offline instrumentation HOT 4
- Jacoco 0.8.11 not working for offline instrumentation HOT 1
- Report-aggregate better configurable from mvn command
- Partial branch coverage being shown on exhaustive switch statements HOT 4
- Jacoco requires coverage threshold lower than generated coverage HOT 1
- Investigate why Kotlin K2 compiler produces line numbers in the enums `getEntries` method HOT 2
- Jacoco merge/generate: Execution data for class does not match HOT 5
- CommandLineSupport: Do not escape backslash on Windows HOT 2
- Error while analyzing xx\lib\asrt.jar@com/inprise/ejb/Global.class with JaCoCo 0.8.11.202310140853/f33756c. HOT 1
- @ShouldNeverExecute annotation or alternative HOT 1
- Using instrumented code for coverage HOT 2
- Jacoco stopped reporting android unit test coverage HOT 5
- exhaustive switch expression is not fully covered HOT 2
- Filter for empty constructors that do not have arguments should be expanded
- It is laways good to show the in he horrizontal bar, gree <covered code lines %> first then red <how much still to be covered> HOT 2
- Error generating coverage report for working Kotlin 1.9.22 code using jacoco 0.8.9 (cannot reproduce in 0.8.11) HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jacoco.