Hello, I am playing with Kotlin and tried to do a POC for a SonarQube plugin[0] While doing this I encountered a strange behavior (at least for me) SonarQube iterates on iSourceFileCoverage and checks that the number of lines in iSourceFileCoverage do not exceed the number of lines of the source code.
I developed a small sample project which should show the behavior[1] If you look at the output the line count: XXX de/friedenhagen/jacocokotlinsample/App: iClassCoverage.lastLine=6, iSourceFileCoverage.lastLine=18 XXX de/friedenhagen/jacocokotlinsample/App: lines=17 lastLine=18 lastLine is 18 but only 17 lines are found in the source[2]. The jacoco-maven-plugin is able to render the coverage correctly[3]. Note that kotlin creates a synthetic class AppKt file for methods not found directly in the class, i.e. the companion object and the outer method defined in [2]. Best Regards Mirko [0] https://groups.google.com/d/topic/sonarqube/eyJa_y_-aoU/discussion [1] https://gitlab.com/mfriedenhagen/jacoco-kotlin-sample/builds/9289284 [2] https://gitlab.com/mfriedenhagen/jacoco-kotlin-sample/blob/e1dacb838191920ddf9eeeffc3dfb20d622e3bd1/src/main/kotlin/de/friedenhagen/jacocokotlinsample/App.kt [3] https://mfriedenhagen.gitlab.io/jacoco-kotlin-sample/ -- http://illegalstateexception.blogspot.com/ https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen) https://bitbucket.org/mfriedenhagen/ -- You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CAK8jvqwa6WzHVAuK7mUqpZDy8Ae76yEvXC8R5k_-7AscoH0gvg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
