I was playing with https://kotlin.github.io/dataframe/overview.html and wanted to see how complicated it looks to call from Java instead of Kotlin. I found many places where there are methods that show in javap
output, e.g.:
$ javap -cp . org/jetbrains/kotlinx/dataframe/api/GroupByKt.class
Compiled from "groupBy.kt"
public final class org.jetbrains.kotlinx.dataframe.api.GroupByKt {
...
public static org.jetbrains.kotlinx.dataframe.api.GroupBy groupBy$default(org.jetbrains.kotlinx.dataframe.DataFrame, boolean, kotlin.jvm.functions.Function2, int, java.lang.Object);
...
where the last method is named groupBy$default
. After decompiling the JVM bytecode that Kotlin compiler generated, I see it calling the above function.
However, Eclipse complains that it's undefined and it fails to compile the Java class. Maven complains as well:
[ERROR] /prj/ks/KotlinxDataFrameTest.java:[130,21] cannot find symbol
symbol: method groupBy$default(org.jetbrains.kotlinx.dataframe.DataFrame<capture#1 of ?>,boolean,(gb,it)->[...] ""),int,<nulltype>)
location: class org.jetbrains.kotlinx.dataframe.api.GroupByKt
I thought any method that shows up in javap
is callable from Java. What am I missing here?
Edit: added javap -verbose
output based on the comment from @broot:
public static org.jetbrains.kotlinx.dataframe.api.GroupBy groupBy$default(org.jetbrains.kotlinx.dataframe.DataFrame, boolean, kotlin.jvm.functions.Function2, int, java.lang.Object);
descriptor: (Lorg/jetbrains/kotlinx/dataframe/DataFrame;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/api/GroupBy;
flags: (0x1009) ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
Code:
stack=3, locals=5, args_size=5
0: iload_3
1: iconst_1
2: iand
3: ifeq 8
6: iconst_1
7: istore_1
8: aload_0
9: iload_1
10: aload_2
11: invokestatic #32 // Method groupBy:(Lorg/jetbrains/kotlinx/dataframe/DataFrame;ZLkotlin/jvm/functions/Function2;)Lorg/jetbrains/kotlinx/dataframe/api/GroupBy;
14: areturn
StackMapTable: number_of_entries = 1
frame_type = 8 /* same */
LineNumberTable:
line 21: 0