Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeing different behaviour in Jacoco coverage while using sealed class on kotlin 1.6.20 #1332

Open
arpank10 opened this issue Jun 17, 2022 · 4 comments
Labels
feedback pending Further information is requested reproducer required Further information is requested
Projects

Comments

@arpank10
Copy link

Steps to reproduce

  • JaCoCo version: 0.8.8
  • Operating system: MacOS
  • Tool integration: Gradle/Kotlin
  • Complete executable reproducer:
    Attached as a zip
    jacocoReproducer.zip

Steps: (what exactly are you doing with the above reproducer?)

To generate the test reports execute
./gradlew kotlinjacocoTestReport
in the above reproducer.

Same can be run after changing the kotlin version in build.gradle file's plugin section
id 'org.jetbrains.kotlin.jvm' version '1.6.20'

Expected behaviour

For both kotlin 1.4.32 and 1.6.20 coverage should be same for sealed classes

Actual behaviour

For file PreviewScaleType.kt in the attached zip

Using sealed classes with parameterized constructor produces 3 methods for 1.4.32
kotlin_1 4 32

For the same piece of code with kotlin 1.6.20 it produces 2 methods
kotlin_1 6 20

@arpank10 arpank10 added the type: bug 🐛 Something isn't working label Jun 17, 2022
@Godin Godin added this to Candidates in Current work items via automation Jun 17, 2022
@Godin Godin removed this from Candidates in Current work items Jun 17, 2022
@Godin Godin added this to Awaiting triage in Filtering via automation Jun 17, 2022
@Godin
Copy link
Member

Godin commented Jun 17, 2022

@arpank10 your jacocoReproducer.zip doesn't seem to correspond to your screenshots:
after downloading and unpacking, execution of the command

./gradlew kotlinjacocoTestReport

produces the following report

Screenshot 2022-06-18 at 00 19 46

notice that there are classes PreviewScaleType.Companion, PreviewScaleType.FitY and PreviewScaleType.FitX, but no PreviewScaleType that is shown on your screenshots.

And this report is actually the same as the one already packaged in provided jacocoReproducer.zip

@Godin Godin added feedback pending Further information is requested reproducer required Further information is requested and removed type: bug 🐛 Something isn't working labels Jun 17, 2022
@arpank10
Copy link
Author

My bad, we were experimenting with different constructors, and removed the parameterised one.
Here is the working reproducer with both kotlin versions:
jacocoReproducer_1.4.32.zip
jacocoReproducer_1.6.20.zip

@arpank10
Copy link
Author

@Godin Any updates on this?

@marchof
Copy link
Member

marchof commented Jul 26, 2022

@arpank10 No need to ask. Any update would be posted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback pending Further information is requested reproducer required Further information is requested
Projects
Filtering
  
Awaiting triage
Development

No branches or pull requests

3 participants