mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Support property accessor in compatibility mode
This commit is contained in:
24
compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/propertyAnnotation.kt
vendored
Normal file
24
compiler/testData/codegen/java8/box/jvm8/defaults/compatibility/propertyAnnotation.kt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// !API_VERSION: 1.3
|
||||
// !JVM_DEFAULT_MODE: compatibility
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_REFLECT
|
||||
|
||||
annotation class Property(val value: String)
|
||||
annotation class Accessor(val value: String)
|
||||
|
||||
interface Z {
|
||||
@Property("OK")
|
||||
@JvmDefault
|
||||
val z: String
|
||||
@Accessor("OK")
|
||||
get() = "OK"
|
||||
}
|
||||
|
||||
|
||||
class Test : Z
|
||||
|
||||
fun box() : String {
|
||||
val value = Z::z.annotations.filterIsInstance<Property>().single().value
|
||||
if (value != "OK") return value
|
||||
return (Z::z.getter.annotations.single() as Accessor).value
|
||||
}
|
||||
29
compiler/testData/codegen/java8/writeFlags/defaults/compatibility/propertyAccessors.kt
vendored
Normal file
29
compiler/testData/codegen/java8/writeFlags/defaults/compatibility/propertyAccessors.kt
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
// !API_VERSION: 1.3
|
||||
// !JVM_DEFAULT_MODE: compatibility
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface Test {
|
||||
@JvmDefault
|
||||
val test: String
|
||||
get() = "OK"
|
||||
|
||||
@JvmDefault
|
||||
var test2: String
|
||||
get() = "OK"
|
||||
set(field) {}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, access$getTest$jd$jd
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, access$getTest2$jd$jd
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
|
||||
// TESTED_OBJECT_KIND: function
|
||||
// TESTED_OBJECTS: Test, access$setTest2$jd$jd
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC
|
||||
|
||||
Reference in New Issue
Block a user