Implement kotlin.jvm.overloads annotation for generating all overloads of a method that has default parameter values.

#KT-2095 Fixed
This commit is contained in:
Dmitry Jemerov
2015-03-27 18:48:03 +01:00
parent c1c9d3b090
commit e15b984232
14 changed files with 321 additions and 46 deletions
@@ -0,0 +1,11 @@
class C {
[kotlin.jvm.overloads] public fun foo(d1: Double, d2: Double, status: String = "OK"): String {
return if (d1 + d2 == 3.0) status else "fail"
}
}
fun box(): String {
val c = C()
val m = c.javaClass.getMethod("foo", javaClass<Double>(), javaClass<Double>())
return m.invoke(c, 1.0, 2.0) as String
}