jacoco / jacoco/jacoco

Do not filter-out `@JvmMultifileClass` in Kotlin

Open
#1,843 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: core.filters language: Kotlin
Dominant language
Java
Stars
4.6k
Forks
1.2k
Avg merge
1d 9h
Merged PRs (30d)
23

Description

See

For

src/A.kt

@file:JvmName("Example")
@file:JvmMultifileClass

fun a() {
} // line 5

src/B.kt

@file:JvmName("Example")
@file:JvmMultifileClass

fun b() {
} // line 5

execution of

kotlin-2.1.10/bin/kotlinc -d classes src
javap -v -p classes/Example.class
javap -v -p classes/Example__AKt.class
javap -v -p classes/Example__BKt.class

produces

public final class Example
  minor version: 0
  major version: 52
  flags: (0x0031) ACC_PUBLIC, ACC_FINAL, ACC_SUPER
  this_class: #2                          // Example
  super_class: #4                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 2, attributes: 1
{
  public static final void a();
    descriptor: ()V
    flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=0, locals=0, args_size=0
         0: invokestatic  #10                 // Method Example__AKt.a:()V
         3: return
      LineNumberTable:
        line 1: 0

  public static final void b();
    descriptor: ()V
    flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=0, locals=0, args_size=0
         0: invokestatic  #15                 // Method Example__BKt.b:()V
         3: return
      LineNumberTable:
        line 1: 0
}
RuntimeVisibleAnnotations:
  0: #16(#17=[I#18,I#19,I#20],#21=I#22,#23=I#24,#25=[s#7,s#12])
    kotlin.Metadata(
      mv=[2,1,0]
      k=4
      xi=48
      d1=["Example__AKt","Example__BKt"]
    )
final class Example__AKt
  minor version: 0
  major version: 52
  flags: (0x1030) ACC_FINAL, ACC_SUPER, ACC_SYNTHETIC
  this_class: #2                          // Example__AKt
  super_class: #4                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 1, attributes: 2
{
  public static final void a();
    descriptor: ()V
    flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=0, locals=0, args_size=0
         0: return
      LineNumberTable:
        line 5: 0
}
SourceFile: "A.kt"
RuntimeVisibleAnnotations:
  0: #7(#8=[I#9,I#10,I#11],#12=I#13,#14=I#15,#16=[s#17],#18=[s#5,s#19],#20=s#21)
    kotlin.Metadata(
      mv=[2,1,0]
      k=5
      xi=48
      d1=["\u0000\u0006\n\u0000\n\u0002\u0010\u0002\u001a\u0006\u0010\u0000\u001a\u00020\u0001"]
      d2=["a",""]
      xs="Example"
    )
final class Example__BKt
  minor version: 0
  major version: 52
  flags: (0x1030) ACC_FINAL, ACC_SUPER, ACC_SYNTHETIC
  this_class: #2                          // Example__BKt
  super_class: #4                         // java/lang/Object
  interfaces: 0, fields: 0, methods: 1, attributes: 2
{
  public static final void b();
    descriptor: ()V
    flags: (0x0019) ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    Code:
      stack=0, locals=0, args_size=0
         0: return
      LineNumberTable:
        line 5: 0
}
SourceFile: "B.kt"
RuntimeVisibleAnnotations:
  0: #7(#8=[I#9,I#10,I#11],#12=I#13,#14=I#15,#16=[s#17],#18=[s#5,s#19],#20=s#21)
    kotlin.Metadata(
      mv=[2,1,0]
      k=5
      xi=48
      d1=["\u0000\u0006\n\u0000\n\u0002\u0010\u0002\u001a\u0006\u0010\u0000\u001a\u00020\u0001"]
      d2=["b",""]
      xs="Example"
    )

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the provided A.kt and B.kt sources, Kotlin compiler commands, and javap output. Then trace JaCoCo's class-filtering path for the Example facade and Example__AKt/Example__BKt classes. Done means @JvmMultifileClass output is handled without incorrectly filtering the relevant classes, with a regression test for this reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
testing-qa, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.