robstoll
02/25/2018, 12:41 PMclass A{}
fun A.test(i: Int): Int = 1
@Deprecated("use new fun which returns int")
fun test(a: A, i :Int): Float = 1.1f
fun main(vararg args: String){
val a = A()
a.test(1)
test(a, 1)
}
arekolek
02/26/2018, 10:09 AMJVM is capable of calling the correct overload of a method only based on the distinguishing return typeno, not really
robstoll
02/26/2018, 10:22 AMarekolek
02/26/2018, 11:20 AMarekolek
02/26/2018, 11:20 AMarekolek
02/26/2018, 11:21 AMtest
functions from javarobstoll
02/26/2018, 2:07 PMrobstoll
02/26/2018, 2:08 PMarekolek
02/26/2018, 2:33 PMI think you mix up JVM with Kotlin, JVM does not have extension functions.extension functions defined in kotlin are accessible in java as static methods with the receiver as first parameter
arekolek
02/26/2018, 2:36 PMAll the functions and properties declared in a fileinside a packageexample.kt
, including extension functions, are compiled into static methods of a Java class namedorg.foo.bar
.org.foo.bar.ExampleKt
https://kotlinlang.org/docs/reference/java-to-kotlin-interop.html#package-level-functions
robstoll
02/26/2018, 2:37 PMrobstoll
02/26/2018, 2:37 PMarekolek
02/26/2018, 2:39 PMtest
functions from java"?robstoll
02/26/2018, 3:10 PMrobstoll
02/26/2018, 3:11 PM