Support @JvmStatic and @JvmOverload in annotation companion

This commit is contained in:
Mikhael Bogdanov
2020-10-30 19:43:35 +01:00
parent 7ec2d036ae
commit e20093d762
5 changed files with 23 additions and 5 deletions
+17
View File
@@ -9,6 +9,10 @@ class Test {
public static String test1() {
return A.sayHello();
}
public static String test2() {
return B.sayHello();
}
}
// FILE: simpleCompanionObject.kt
@@ -22,8 +26,21 @@ interface A {
}
}
}
annotation class B {
companion object {
@JvmStatic
@JvmOverloads
fun sayHello(greeting: String = "OK"): String {
return greeting
}
}
}
fun box(): String {
if (Test.test1() != "OK") return "fail 1"
if (Test.test2() != "OK") return "fail 2"
return "OK"
}