pajatopmr

    pajatopmr

    3 years ago
    IntelliJ does a nice job with @Serializable when generating code coverage info but Jacoco still has problems (I’m guessing with annotations that Kotlin needs to fix). In any case, is anyone aware of workarounds or solutions that get Jacoco to 100% on @Serializable code?
    gildor

    gildor

    3 years ago
    Maybe just add some filter for classes with @Serializable annotation? Jacoco already have some support of Kotlin generated code, I would report it to kotlinx.serialization or jacoco to support coverage
    s

    sandwwraith

    3 years ago
    How does Jacoco deal with other generated code? (copy method of data classes, etc)
    Serialization methods don't have line numbers, so they should not be visible to Jacoco anyway...
    pajatopmr

    pajatopmr

    3 years ago
    Fwiw, this screenshot shows in red items that IntelliJ does not complain about. All are related to @Serializable.
    @sandwwraith can you offer a little guidance on how to construct a filter for one or more of these items?
    I’m assuming we are talking about adding elements via the “excludes = […]” parameter to the
    jacoco
    closure.
    s

    sandwwraith

    3 years ago
    I'm not very familiar with filters, but probably you can exclude every
    write$Self
    function and constructors which contain
    SerializationConstructorMarker
    as the last argument