609d696202
Annotation arguments with default values are rendered as ... if renderDefaultAnnotationArguments is true. Tests: java retention does not taken into account by Descriptor comparator. Java retentinon changed to kotlin retention in some tests + one new test with java retention added. More accurate tests for intentions in byte code (visibility controlled).
34 lines
817 B
Kotlin
34 lines
817 B
Kotlin
package test.annotations
|
|
|
|
import kotlin.*
|
|
import kotlin.test.assertTrue
|
|
import org.junit.Test as test
|
|
|
|
annotation(retention = AnnotationRetention.RUNTIME) class MyAnno
|
|
|
|
MyAnno
|
|
Deprecated
|
|
class AnnotatedClass
|
|
|
|
|
|
class AnnotationTest {
|
|
test fun annotationType() {
|
|
val annotations = javaClass<AnnotatedClass>().getAnnotations()!!
|
|
|
|
var foundMyAnno = false
|
|
var foundDeprecated = false
|
|
|
|
for (annotation in annotations) {
|
|
val clazz = annotation!!.annotationType()
|
|
when {
|
|
clazz == javaClass<MyAnno>() -> foundMyAnno = true
|
|
clazz == javaClass<Deprecated>() -> foundDeprecated = true
|
|
else -> {}
|
|
}
|
|
}
|
|
|
|
assertTrue(foundMyAnno)
|
|
assertTrue(foundDeprecated)
|
|
}
|
|
}
|