Support @JvmStatic and @JvmOverload in annotation companion
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user