mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 08:31:35 +00:00
In JDK 9, Class.simpleName changed behavior for local/anonymous Kotlin classes (see KT-23072), this is why we now check for both variants of the name in tests. Also, the format of annotation arguments changed a little, where float parameters no longer have the trailing "f", and class literals are rendered with ".class" at the end
30 lines
644 B
Kotlin
Vendored
30 lines
644 B
Kotlin
Vendored
// WITH_REFLECT
|
|
// TARGET_BACKEND: JVM
|
|
// FILE: Anno.java
|
|
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
public @interface Anno {
|
|
Class<?> value() default void.class;
|
|
}
|
|
|
|
// FILE: test.kt
|
|
|
|
import kotlin.test.assertTrue
|
|
|
|
class C {
|
|
@Anno
|
|
fun f1() {}
|
|
|
|
@Anno(Void::class)
|
|
fun f2() {}
|
|
}
|
|
|
|
fun box(): String {
|
|
assertTrue("\\[@Anno\\(value=void(\\.class)?\\)\\]".toRegex().matches(C::f1.annotations.toString()))
|
|
assertTrue("\\[@Anno\\(value=(class )?java.lang.Void(\\.class)?\\)\\]".toRegex().matches(C::f2.annotations.toString()))
|
|
return "OK"
|
|
}
|