cab53361f3
Add some more filters on private/synthetic stuff (which doesn't matter in practice) to make full and light analysis mode dumps as similar as possible, so that all existing tests will pass for JVM IR. Unmute some tests which were failing with the old JVM backend. Tests on repeatable annotations are muted because in full analysis, annotations are wrapped into the container (e.g. `@A(1) @A(2)` -> `@A$Container(A(1), A(2))`), but they are no in the light analysis mode. So there's always going to be a difference for these tests between full and light analysis, unless we're going to change behavior of kapt, which would be a kind of a breaking change. #KT-58497 Fixed
46 lines
1.2 KiB
Kotlin
Vendored
46 lines
1.2 KiB
Kotlin
Vendored
// !LANGUAGE: +RepeatableAnnotations
|
|
// TARGET_BACKEND: JVM_IR
|
|
// WITH_STDLIB
|
|
// FULL_JDK
|
|
// JVM_TARGET: 1.8
|
|
|
|
// java.lang.NoSuchMethodError: java.lang.Class.getAnnotationsByType
|
|
// IGNORE_BACKEND: ANDROID
|
|
|
|
// In light analysis mode, repeated annotations are not wrapped into the container. This is by design, so that in kapt stubs repeated
|
|
// annotations will be visible unwrapped.
|
|
// IGNORE_LIGHT_ANALYSIS
|
|
|
|
// FILE: box.kt
|
|
|
|
@Repeatable
|
|
annotation class A(val value: String)
|
|
|
|
@A("O")
|
|
@A("")
|
|
@A("K")
|
|
class Z
|
|
|
|
fun box(): String {
|
|
val annotations = Z::class.java.annotations.filter { it.annotationClass != Metadata::class }
|
|
val aa = annotations.singleOrNull() ?: return "Fail 1: $annotations"
|
|
|
|
val a = ContainerSupport.load(aa)
|
|
if (a.size != 3) return "Fail 2: $a"
|
|
|
|
val bytype = Z::class.java.getAnnotationsByType(A::class.java)
|
|
if (a.toList() != bytype.toList()) return "Fail 3: ${a.toList()} != ${bytype.toList()}"
|
|
|
|
return a.fold("") { acc, it -> acc + it.value }
|
|
}
|
|
|
|
// FILE: ContainerSupport.java
|
|
|
|
import java.lang.annotation.Annotation;
|
|
|
|
public class ContainerSupport {
|
|
public static A[] load(Annotation container) {
|
|
return ((A.Container) container).value();
|
|
}
|
|
}
|