Don't generate annotations on $default methods
#KT-29965 Fixed
This commit is contained in:
@@ -18,22 +18,26 @@ fun test(name: String, annotations: Array<out Annotation>) {
|
||||
assertEquals(1, annotations.filterIsInstance<Ann>().single().x, "$name[0]")
|
||||
}
|
||||
|
||||
fun testAbsence(name: String, annotations: Array<out Annotation>) {
|
||||
assertEquals(0, annotations.filterIsInstance<Ann>().size, "$name")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = A::class.java.getDeclaredMethods().first { it.getName() == "foo" }
|
||||
test("foo", foo.getDeclaredAnnotations())
|
||||
|
||||
val fooDefault = A::class.java.getDeclaredMethods().first { it.getName() == "foo\$default" }
|
||||
test("foo", foo.getDeclaredAnnotations())
|
||||
testAbsence("foo\$default", fooDefault.getDeclaredAnnotations())
|
||||
|
||||
val (secondary, secondaryDefault) = A::class.java.getDeclaredConstructors().partition { it.getParameterTypes().size == 3 }
|
||||
|
||||
test("secondary", secondary[0].getDeclaredAnnotations())
|
||||
test("secondary\$default", secondaryDefault[0].getDeclaredAnnotations())
|
||||
testAbsence("secondary\$default", secondaryDefault[0].getDeclaredAnnotations())
|
||||
|
||||
val (primary, primaryDefault) = B::class.java.getConstructors().partition { it.getParameterTypes().size == 3 }
|
||||
|
||||
test("primary", primary[0].getDeclaredAnnotations())
|
||||
test("primary\$default", primaryDefault[0].getDeclaredAnnotations())
|
||||
testAbsence("primary\$default", primaryDefault[0].getDeclaredAnnotations())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user