Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add validation test for @JvmMultifileClass in Kotlin #1843

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

Open
Godin opened this issue Jan 22, 2025 · 0 comments
Open

Add validation test for @JvmMultifileClass in Kotlin #1843

Godin opened this issue Jan 22, 2025 · 0 comments

Comments

@Godin
Copy link
Member

Godin commented Jan 22, 2025

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"
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant