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

Unable to get the coverage for kotlin Parcelize class #1364

Open
jnhyperion opened this issue Sep 26, 2022 · 2 comments
Open

Unable to get the coverage for kotlin Parcelize class #1364

jnhyperion opened this issue Sep 26, 2022 · 2 comments
Labels
type: bug 🐛 Something isn't working

Comments

@jnhyperion
Copy link

jnhyperion commented Sep 26, 2022

Steps to reproduce

  • JaCoCo version: 0.8.2
  • Operating system: Android
  • Tool integration: Gradle
  • Steps:
  1. kotlin java class:
import android.os.Parcelable
import kotlinx.parcelize.Parcelize
@Parcelize
data class Example (
    val foo: String?,
    val bar: String?
) : Parcelable
  1. compiled class:
public final class Example implements Parcelable {
   
    @Metadata(bv = {1, 0, 3}, k = 3, mv = {1, 4, 2})
    /* loaded from: classes4.dex */
    public static class Creator implements Parcelable.Creator< Example > {
        private static transient /* synthetic */ boolean[] $jacocoData;

        private static /* synthetic */ boolean[] $jacocoInit() {
            boolean[] zArr = $jacocoData;
            if (zArr != null) {
                return zArr;
            }
            boolean[] probes = Offline.getProbes(-2679507796986290106L, "...", 9);
            $jacocoData = probes;
            return probes;
        }

        public Creator() {
            $jacocoInit()[0] = true;
        }

        /* JADX WARN: Can't rename method to resolve collision */
        @Override // android.os.Parcelable.Creator
        public final Example createFromParcel(Parcel in) {
            ...
        }

        /* JADX WARN: Can't rename method to resolve collision */
        @Override // android.os.Parcelable.Creator
        public final Example[] newArray(int i) {
            ...
        }
    }

expected behaviour

the automatically generate class Creator and it's methods createFromParcel & newArray should be accessed and calculated in the coverage report, or they should be ignored simply.

Actual behaviour

they have never been accessed as 0% coverage in the coverage report.

image

@jnhyperion jnhyperion added the type: bug 🐛 Something isn't working label Sep 26, 2022
@marchof
Copy link
Member

marchof commented Sep 26, 2022

Hi @jnhyperion, JaCoCo 0.8.2 is about 4 years old and Kotin support has been improved over the years. Please upgrade to current Version 0.8.8.

@marchof marchof added the feedback pending Further information is requested label Sep 26, 2022
@jnhyperion
Copy link
Author

@marchof I upgrade jacoco to 0.8.8, unfortunately problem still exists.

@marchof marchof removed the feedback pending Further information is requested label Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants