Introduce KProperty{0,1,2}.getDelegate
#KT-8384 In Progress
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// No kotlin-reflect.jar in this test
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = ""
|
||||
}
|
||||
|
||||
val foo: String by Delegate
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
::foo.getDelegate()
|
||||
return "Fail: error should have been thrown"
|
||||
}
|
||||
catch (e: KotlinReflectionNotSupportedError) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = true
|
||||
}
|
||||
|
||||
class Foo {
|
||||
val isOK: Boolean by Delegate
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
assertEquals(Delegate, Foo::isOK.apply { isAccessible = true }.getDelegate(foo))
|
||||
assertEquals(Delegate, foo::isOK.apply { isAccessible = true }.getDelegate())
|
||||
return if (foo.isOK) "OK" else "Fail"
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
class Foo
|
||||
|
||||
var Foo.result: String by Delegate
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
foo.result = "Fail"
|
||||
val d = (foo::result).apply { isAccessible = true }.getDelegate() as Delegate
|
||||
foo.result = "OK"
|
||||
assertEquals(d, (foo::result).apply { isAccessible = true }.getDelegate())
|
||||
assertEquals(d, (Foo()::result).apply { isAccessible = true }.getDelegate())
|
||||
return d.getValue(foo, Foo::result)
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
class Foo {
|
||||
var result: String by Delegate
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
foo.result = "Fail"
|
||||
val d = (foo::result).apply { isAccessible = true }.getDelegate() as Delegate
|
||||
foo.result = "OK"
|
||||
assertEquals(d, (foo::result).apply { isAccessible = true }.getDelegate())
|
||||
assertEquals(d, (Foo()::result).apply { isAccessible = true }.getDelegate())
|
||||
return d.getValue(foo, Foo::result)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
class Foo
|
||||
|
||||
var Foo.result: String by Delegate
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
foo.result = "Fail"
|
||||
val d = Foo::result.apply { isAccessible = true }.getDelegate(foo) as Delegate
|
||||
foo.result = "OK"
|
||||
assertEquals(d, Foo::result.apply { isAccessible = true }.getDelegate(foo))
|
||||
return d.getValue(foo, Foo::result)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = "OK"
|
||||
}
|
||||
|
||||
open class Base {
|
||||
val x: String by Delegate
|
||||
}
|
||||
|
||||
class Derived : Base()
|
||||
|
||||
fun box(): String {
|
||||
val d = Derived()
|
||||
assertEquals(
|
||||
(Base::x).apply { isAccessible = true }.getDelegate(d),
|
||||
(Derived::x).apply { isAccessible = true }.getDelegate(d)
|
||||
)
|
||||
return d.x
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.KProperty0
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
var ref: KProperty<*>? = null
|
||||
|
||||
class Delegate {
|
||||
var storage = ""
|
||||
operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate {
|
||||
ref = property
|
||||
return this
|
||||
}
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>): String = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
var result: String by Delegate()
|
||||
|
||||
fun box(): String {
|
||||
result
|
||||
val prop = ref as KProperty0<*>
|
||||
|
||||
result = "Fail"
|
||||
val d = prop.apply { isAccessible = true }.getDelegate() as Delegate
|
||||
result = "OK"
|
||||
assertEquals(d, prop.apply { isAccessible = true }.getDelegate())
|
||||
return result
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
class Bar
|
||||
|
||||
class Foo {
|
||||
var Bar.result: String by Delegate
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
val bar = Bar()
|
||||
with(foo) { bar.result = "Fail" }
|
||||
val prop = Foo::class.members.single { it.name == "result" } as KMutableProperty2<Foo, Bar, String>
|
||||
val d = prop.apply { isAccessible = true }.getDelegate(foo, bar) as Delegate
|
||||
with(foo) { bar.result = "OK" }
|
||||
assertEquals(d, prop.apply { isAccessible = true }.getDelegate(foo, bar))
|
||||
return d.getValue(foo, prop)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
class Foo {
|
||||
var result: String by Delegate
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
foo.result = "Fail"
|
||||
val d = (Foo::result).apply { isAccessible = true }.getDelegate(foo) as Delegate
|
||||
foo.result = "OK"
|
||||
assertEquals(d, (Foo::result).apply { isAccessible = true }.getDelegate(foo))
|
||||
return d.getValue(foo, Foo::result)
|
||||
}
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
class Delegate(val value: String) {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = value
|
||||
}
|
||||
|
||||
class Foo {
|
||||
val x: String by Delegate("class")
|
||||
|
||||
companion object {
|
||||
val x: String by Delegate("companion")
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
assertEquals("class", ((foo::x).apply { isAccessible = true }.getDelegate() as Delegate).value)
|
||||
assertEquals("class", ((Foo::x).apply { isAccessible = true }.getDelegate(foo) as Delegate).value)
|
||||
assertEquals("companion", ((Foo.Companion::x).apply { isAccessible = true }.getDelegate() as Delegate).value)
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.full.extensionReceiverParameter
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
class Delegate(val value: String) {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = value
|
||||
}
|
||||
|
||||
class Foo
|
||||
|
||||
val Foo.bar: String by Delegate("Foo")
|
||||
val String.bar: String by Delegate("String")
|
||||
val Unit.bar: String by Delegate("Unit")
|
||||
|
||||
class MemberExtensions {
|
||||
val Foo?.bar: String by Delegate("Foo")
|
||||
val String?.bar: String by Delegate("String")
|
||||
val Unit?.bar: String by Delegate("Unit")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo()
|
||||
|
||||
assertEquals("Foo", ((foo::bar).apply { isAccessible = true }.getDelegate() as Delegate).value)
|
||||
assertEquals("Foo", ((Foo::bar).apply { isAccessible = true }.getDelegate(foo) as Delegate).value)
|
||||
assertEquals("String", ((""::bar).apply { isAccessible = true }.getDelegate() as Delegate).value)
|
||||
assertEquals("String", ((String::bar).apply { isAccessible = true }.getDelegate("") as Delegate).value)
|
||||
assertEquals("Unit", ((Unit::bar).apply { isAccessible = true }.getDelegate() as Delegate).value)
|
||||
|
||||
val me = MemberExtensions::class.members.filter { it.name == "bar" } as List<KProperty2<MemberExtensions, Any?, String>>
|
||||
assertEquals(listOf("Foo", "String", "Unit"), me.sortedBy {
|
||||
it.extensionReceiverParameter!!.type.toString()
|
||||
}.map {
|
||||
(it.apply { isAccessible = true }.getDelegate(MemberExtensions(), null) as Delegate).value
|
||||
})
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.KProperty2
|
||||
import kotlin.reflect.full.IllegalPropertyDelegateAccessException
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = true
|
||||
}
|
||||
|
||||
val topLevel: Boolean by Delegate
|
||||
val String.extension: Boolean by Delegate
|
||||
|
||||
class Foo {
|
||||
val member: Boolean by Delegate
|
||||
val String.memberExtension: Boolean by Delegate
|
||||
}
|
||||
|
||||
inline fun check(block: () -> Unit) {
|
||||
try {
|
||||
block()
|
||||
throw AssertionError("No IllegalPropertyDelegateAccessException has been thrown")
|
||||
} catch (e: IllegalPropertyDelegateAccessException) {
|
||||
// OK
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
check { ::topLevel.getDelegate() }
|
||||
|
||||
check { String::extension.getDelegate("") }
|
||||
check { ""::extension.getDelegate() }
|
||||
|
||||
val foo = Foo()
|
||||
check { Foo::member.getDelegate(foo) }
|
||||
check { foo::member.getDelegate() }
|
||||
|
||||
val me = Foo::class.members.single { it.name == "memberExtension" } as KProperty2<Foo, String, Boolean>
|
||||
check { me.getDelegate(foo, "") }
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty2
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
val topLevel: Boolean = true
|
||||
val String.extension: Boolean get() = true
|
||||
|
||||
class Foo {
|
||||
val member: Boolean = true
|
||||
val String.memberExtension: Boolean get() = true
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertNull(::topLevel.apply { isAccessible = true }.getDelegate())
|
||||
|
||||
assertNull(String::extension.apply { isAccessible = true }.getDelegate(""))
|
||||
assertNull(""::extension.apply { isAccessible = true }.getDelegate())
|
||||
|
||||
assertNull(Foo::member.apply { isAccessible = true }.getDelegate(Foo()))
|
||||
assertNull(Foo()::member.apply { isAccessible = true }.getDelegate())
|
||||
|
||||
val me = Foo::class.members.single { it.name == "memberExtension" } as KProperty2<Foo, String, Boolean>
|
||||
assertNull(me.apply { isAccessible = true }.getDelegate(Foo(), ""))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
class Delegate(val value: String) {
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = value
|
||||
}
|
||||
|
||||
open class Base {
|
||||
open val x: String by Delegate("Base")
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
override val x: String by Delegate("Derived")
|
||||
}
|
||||
|
||||
fun check(expected: String, delegate: Any?) {
|
||||
if (delegate == null) throw AssertionError("getDelegate returned null")
|
||||
assertEquals(expected, (delegate as Delegate).value)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val base = Base()
|
||||
val derived = Derived()
|
||||
|
||||
check("Base", (Base::x).apply { isAccessible = true }.getDelegate(base))
|
||||
check("Base", (base::x).apply { isAccessible = true }.getDelegate())
|
||||
check("Derived", (Derived::x).apply { isAccessible = true }.getDelegate(derived))
|
||||
check("Derived", (derived::x).apply { isAccessible = true }.getDelegate())
|
||||
|
||||
check("Base", (Base::x).apply { isAccessible = true }.getDelegate(derived))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
import kotlin.test.*
|
||||
|
||||
object Delegate {
|
||||
var storage = ""
|
||||
operator fun getValue(instance: Any?, property: KProperty<*>) = storage
|
||||
operator fun setValue(instance: Any?, property: KProperty<*>, value: String) { storage = value }
|
||||
}
|
||||
|
||||
var result: String by Delegate
|
||||
|
||||
fun box(): String {
|
||||
result = "Fail"
|
||||
val p = (::result).apply { isAccessible = true }
|
||||
val d = p.getDelegate() as Delegate
|
||||
result = "OK"
|
||||
assertEquals(d, (::result).apply { isAccessible = true }.getDelegate())
|
||||
return d.getValue(null, p)
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class GetDelegateWithoutReflectionKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field foo$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getFoo(): java.lang.String
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class BooleanPropertyNameStartsWithIsKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private method <init>(): void
|
||||
public final method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): boolean
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field isOK$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final method isOK(): boolean
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class BoundExtensionPropertyKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getResult(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||
public final static method setResult(@org.jetbrains.annotations.NotNull p0: Foo, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public method <init>(): void
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class BoundMemberPropertyKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||
public final method setResult(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class ExtensionPropertyKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getResult(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||
public final static method setResult(@org.jetbrains.annotations.NotNull p0: Foo, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public method <init>(): void
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public class Base {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Derived {
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class FakeOverrideKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
private @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method provideDelegate(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): Delegate
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class KPropertyForDelegatedPropertyKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private static @org.jetbrains.annotations.Nullable field ref: kotlin.reflect.KProperty
|
||||
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.Nullable method getRef(): kotlin.reflect.KProperty
|
||||
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||
public final static method setRef(@org.jetbrains.annotations.Nullable p0: kotlin.reflect.KProperty): void
|
||||
public final static method setResult(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
@kotlin.Metadata
|
||||
public final class Bar {
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getResult(@org.jetbrains.annotations.NotNull p0: Bar): java.lang.String
|
||||
public final method setResult(@org.jetbrains.annotations.NotNull p0: Bar, @org.jetbrains.annotations.NotNull p1: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MemberExtensionPropertyKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||
public final method setResult(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MemberPropertyKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
public final static field Companion: Foo.Companion
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate$1: Delegate
|
||||
private final static @org.jetbrains.annotations.NotNull field x$delegate: Delegate
|
||||
inner class Foo/Companion
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final static class Foo/Companion {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
inner class Foo/Companion
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NameClashClassAndCompanionKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class MemberExtensions {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field bar$delegate$1: Delegate
|
||||
private final @org.jetbrains.annotations.NotNull field bar$delegate$2: Delegate
|
||||
private final @org.jetbrains.annotations.NotNull field bar$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.Nullable p0: Foo): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.Nullable p0: java.lang.String): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.Nullable p0: kotlin.Unit): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NameClashExtensionPropertiesKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field bar$delegate$1: Delegate
|
||||
private final static @org.jetbrains.annotations.NotNull field bar$delegate$2: Delegate
|
||||
private final static @org.jetbrains.annotations.NotNull field bar$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getBar(@org.jetbrains.annotations.NotNull p0: kotlin.Unit): java.lang.String
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private method <init>(): void
|
||||
public final method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): boolean
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field member$delegate: Delegate
|
||||
private final @org.jetbrains.annotations.NotNull field memberExtension$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public final method getMember(): boolean
|
||||
public final method getMemberExtension(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NoSetAccessibleTrueKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field extension$delegate: Delegate
|
||||
private final static @org.jetbrains.annotations.NotNull field topLevel$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method check(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
|
||||
public final static method getExtension(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public final static method getTopLevel(): boolean
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
private final field member: boolean
|
||||
public method <init>(): void
|
||||
public final method getMember(): boolean
|
||||
public final method getMemberExtension(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class NotDelegatedPropertyKt {
|
||||
private final static field topLevel: boolean
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method getExtension(@org.jetbrains.annotations.NotNull p0: java.lang.String): boolean
|
||||
public final static method getTopLevel(): boolean
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
@kotlin.Metadata
|
||||
public class Base {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Derived {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final @org.jetbrains.annotations.NotNull field x$delegate: Delegate
|
||||
public method <init>(): void
|
||||
public @org.jetbrains.annotations.NotNull method getX(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class OverrideDelegatedByDelegatedKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method check(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object): void
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
public final class Delegate {
|
||||
public final static field INSTANCE: Delegate
|
||||
private static @org.jetbrains.annotations.NotNull field storage: java.lang.String
|
||||
private method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getStorage(): java.lang.String
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||
public final method setStorage(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.NotNull p2: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TopLevelPropertyKt {
|
||||
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||
public final static method setResult(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
+99
@@ -6032,6 +6032,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("getDelegateWithoutReflection.kt")
|
||||
public void testGetDelegateWithoutReflection() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inClassVal.kt")
|
||||
public void testInClassVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/inClassVal.kt");
|
||||
@@ -14556,6 +14562,99 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class GetDelegate extends AbstractIrBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInGetDelegate() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("booleanPropertyNameStartsWithIs.kt")
|
||||
public void testBooleanPropertyNameStartsWithIs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundExtensionProperty.kt")
|
||||
public void testBoundExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverride.kt")
|
||||
public void testFakeOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/fakeOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kPropertyForDelegatedProperty.kt")
|
||||
public void testKPropertyForDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashClassAndCompanion.kt")
|
||||
public void testNameClashClassAndCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashExtensionProperties.kt")
|
||||
public void testNameClashExtensionProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noSetAccessibleTrue.kt")
|
||||
public void testNoSetAccessibleTrue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notDelegatedProperty.kt")
|
||||
public void testNotDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideDelegatedByDelegated.kt")
|
||||
public void testOverrideDelegatedByDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/specialBuiltIns")
|
||||
|
||||
@@ -6032,6 +6032,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("getDelegateWithoutReflection.kt")
|
||||
public void testGetDelegateWithoutReflection() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inClassVal.kt")
|
||||
public void testInClassVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/inClassVal.kt");
|
||||
@@ -14556,6 +14562,99 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class GetDelegate extends AbstractBlackBoxCodegenTest {
|
||||
public void testAllFilesPresentInGetDelegate() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("booleanPropertyNameStartsWithIs.kt")
|
||||
public void testBooleanPropertyNameStartsWithIs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundExtensionProperty.kt")
|
||||
public void testBoundExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverride.kt")
|
||||
public void testFakeOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/fakeOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kPropertyForDelegatedProperty.kt")
|
||||
public void testKPropertyForDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashClassAndCompanion.kt")
|
||||
public void testNameClashClassAndCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashExtensionProperties.kt")
|
||||
public void testNameClashExtensionProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noSetAccessibleTrue.kt")
|
||||
public void testNoSetAccessibleTrue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notDelegatedProperty.kt")
|
||||
public void testNotDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideDelegatedByDelegated.kt")
|
||||
public void testOverrideDelegatedByDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/specialBuiltIns")
|
||||
|
||||
+99
@@ -6032,6 +6032,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("getDelegateWithoutReflection.kt")
|
||||
public void testGetDelegateWithoutReflection() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inClassVal.kt")
|
||||
public void testInClassVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/inClassVal.kt");
|
||||
@@ -14556,6 +14562,99 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class GetDelegate extends AbstractLightAnalysisModeCodegenTest {
|
||||
public void testAllFilesPresentInGetDelegate() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("booleanPropertyNameStartsWithIs.kt")
|
||||
public void testBooleanPropertyNameStartsWithIs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundExtensionProperty.kt")
|
||||
public void testBoundExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverride.kt")
|
||||
public void testFakeOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/fakeOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kPropertyForDelegatedProperty.kt")
|
||||
public void testKPropertyForDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashClassAndCompanion.kt")
|
||||
public void testNameClashClassAndCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashExtensionProperties.kt")
|
||||
public void testNameClashExtensionProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("noSetAccessibleTrue.kt")
|
||||
public void testNoSetAccessibleTrue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notDelegatedProperty.kt")
|
||||
public void testNotDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideDelegatedByDelegated.kt")
|
||||
public void testOverrideDelegatedByDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/specialBuiltIns")
|
||||
|
||||
@@ -88,6 +88,14 @@ public interface KProperty0<out R> : KProperty<R>, () -> R {
|
||||
*/
|
||||
public fun get(): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(): Any?
|
||||
|
||||
override val getter: Getter<R>
|
||||
|
||||
public interface Getter<out R> : KProperty.Getter<R>, () -> R
|
||||
@@ -126,6 +134,21 @@ public interface KProperty1<T, out R> : KProperty<R>, (T) -> R {
|
||||
*/
|
||||
public fun get(receiver: T): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*
|
||||
* Note that for a top level **extension** property, the delegate is the same for all extension receivers,
|
||||
* so the actual [receiver] instance passed in is not going to make any difference, it must only be a value of [T].
|
||||
*
|
||||
* @param receiver the receiver which is used to obtain the value of the property delegate.
|
||||
* For example, it should be a class instance if this is a member property of that class,
|
||||
* or an extension receiver if this is a top level extension property.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(receiver: T): Any?
|
||||
|
||||
override val getter: Getter<T, R>
|
||||
|
||||
public interface Getter<T, out R> : KProperty.Getter<R>, (T) -> R
|
||||
@@ -171,6 +194,20 @@ public interface KProperty2<D, E, out R> : KProperty<R>, (D, E) -> R {
|
||||
*/
|
||||
public fun get(receiver1: D, receiver2: E): R
|
||||
|
||||
/**
|
||||
* Returns the value of the delegate if this is a delegated property, or `null` if this property is not delegated.
|
||||
* See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/delegated-properties.html)
|
||||
* for more information.
|
||||
*
|
||||
* In case of the extension property in a class, the instance of the class should be passed first
|
||||
* and the instance of the extension receiver second.
|
||||
*
|
||||
* @param receiver1 the instance of the first receiver.
|
||||
* @param receiver2 the instance of the second receiver.
|
||||
*/
|
||||
@SinceKotlin("1.1")
|
||||
public fun getDelegate(receiver1: D, receiver2: E): Any?
|
||||
|
||||
override val getter: Getter<D, E, R>
|
||||
|
||||
public interface Getter<D, E, out R> : KProperty.Getter<R>, (D, E) -> R
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package kotlin.reflect.full
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
|
||||
/**
|
||||
* An exception that is thrown when `call` is invoked on a callable or `get` or `set` is invoked on a property
|
||||
@@ -27,6 +29,20 @@ package kotlin.reflect.full
|
||||
*/
|
||||
class IllegalCallableAccessException(cause: IllegalAccessException) : kotlin.reflect.IllegalCallableAccessException(cause)
|
||||
|
||||
/**
|
||||
* An exception that is thrown when `getDelegate` is invoked on a [KProperty] object that was not made accessible
|
||||
* with [isAccessible].
|
||||
*
|
||||
* @see [kotlin.reflect.KProperty0.getDelegate]
|
||||
* @see [kotlin.reflect.KProperty1.getDelegate]
|
||||
* @see [kotlin.reflect.KProperty2.getDelegate]
|
||||
* @see [kotlin.reflect.jvm.isAccessible]
|
||||
*/
|
||||
class IllegalPropertyDelegateAccessException(cause: IllegalAccessException) : Exception(
|
||||
"Cannot obtain the delegate of a non-accessible property. Use \"isAccessible = true\" to make the property accessible",
|
||||
cause
|
||||
)
|
||||
|
||||
/**
|
||||
* An exception that is thrown when the code tries to introspect a property of a class or a package
|
||||
* and that class or the package no longer has that property.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
import kotlin.reflect.KProperty0
|
||||
|
||||
@@ -31,6 +32,10 @@ internal open class KProperty0Impl<out R> : KProperty0<R>, KPropertyImpl<R> {
|
||||
|
||||
override fun get(): R = getter.call()
|
||||
|
||||
private val delegateFieldValue = lazy(PUBLICATION) { getDelegate(computeDelegateField(), boundReceiver) }
|
||||
|
||||
override fun getDelegate(): Any? = delegateFieldValue.value
|
||||
|
||||
override fun invoke(): R = get()
|
||||
|
||||
class Getter<out R>(override val property: KProperty0Impl<R>) : KPropertyImpl.Getter<R>(), KProperty0.Getter<R> {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
@@ -31,6 +32,10 @@ internal open class KProperty1Impl<T, out R> : KProperty1<T, R>, KPropertyImpl<R
|
||||
|
||||
override fun get(receiver: T): R = getter.call(receiver)
|
||||
|
||||
private val delegateField = lazy(PUBLICATION) { computeDelegateField() }
|
||||
|
||||
override fun getDelegate(receiver: T): Any? = getDelegate(delegateField.value, receiver)
|
||||
|
||||
override fun invoke(receiver: T): R = get(receiver)
|
||||
|
||||
class Getter<T, out R>(override val property: KProperty1Impl<T, R>) : KPropertyImpl.Getter<R>(), KProperty1.Getter<T, R> {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import kotlin.LazyThreadSafetyMode.PUBLICATION
|
||||
import kotlin.jvm.internal.CallableReference
|
||||
import kotlin.reflect.KMutableProperty2
|
||||
import kotlin.reflect.KProperty2
|
||||
@@ -32,6 +33,10 @@ internal open class KProperty2Impl<D, E, out R> : KProperty2<D, E, R>, KProperty
|
||||
|
||||
override fun get(receiver1: D, receiver2: E): R = getter.call(receiver1, receiver2)
|
||||
|
||||
private val delegateField = lazy(PUBLICATION) { computeDelegateField() }
|
||||
|
||||
override fun getDelegate(receiver1: D, receiver2: E): Any? = getDelegate(delegateField.value, receiver1)
|
||||
|
||||
override fun invoke(receiver1: D, receiver2: E): R = get(receiver1, receiver2)
|
||||
|
||||
class Getter<D, E, out R>(override val property: KProperty2Impl<D, E, R>) : KPropertyImpl.Getter<R>(), KProperty2.Getter<D, E, R> {
|
||||
|
||||
@@ -29,6 +29,7 @@ import kotlin.jvm.internal.CallableReference
|
||||
import kotlin.reflect.KFunction
|
||||
import kotlin.reflect.KMutableProperty
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.reflect.full.IllegalPropertyDelegateAccessException
|
||||
import kotlin.reflect.jvm.internal.JvmPropertySignature.*
|
||||
|
||||
internal abstract class KPropertyImpl<out R> private constructor(
|
||||
@@ -81,6 +82,17 @@ internal abstract class KPropertyImpl<out R> private constructor(
|
||||
|
||||
val javaField: Field? get() = javaField_()
|
||||
|
||||
protected fun computeDelegateField(): Field? =
|
||||
if (@Suppress("DEPRECATION") descriptor.isDelegated) javaField else null
|
||||
|
||||
protected fun getDelegate(field: Field?, receiver: Any?): Any? =
|
||||
try {
|
||||
field?.get(receiver)
|
||||
}
|
||||
catch (e: IllegalAccessException) {
|
||||
throw IllegalPropertyDelegateAccessException(e)
|
||||
}
|
||||
|
||||
override abstract val getter: Getter<R>
|
||||
|
||||
private val descriptor_ = ReflectProperties.lazySoft(descriptorInitialValue) {
|
||||
|
||||
@@ -47,4 +47,9 @@ public abstract class MutablePropertyReference0 extends MutablePropertyReference
|
||||
public KMutableProperty0.Setter getSetter() {
|
||||
return ((KMutableProperty0) getReflected()).getSetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate() {
|
||||
return ((KMutableProperty0) getReflected()).getDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,4 +47,9 @@ public abstract class MutablePropertyReference1 extends MutablePropertyReference
|
||||
public KMutableProperty1.Setter getSetter() {
|
||||
return ((KMutableProperty1) getReflected()).getSetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate(Object receiver) {
|
||||
return ((KMutableProperty1) getReflected()).getDelegate(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +40,9 @@ public abstract class MutablePropertyReference2 extends MutablePropertyReference
|
||||
public KMutableProperty2.Setter getSetter() {
|
||||
return ((KMutableProperty2) getReflected()).getSetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate(Object receiver1, Object receiver2) {
|
||||
return ((KMutableProperty2) getReflected()).getDelegate(receiver1, receiver2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,4 +42,9 @@ public abstract class PropertyReference0 extends PropertyReference implements KP
|
||||
public KProperty0.Getter getGetter() {
|
||||
return ((KProperty0) getReflected()).getGetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate() {
|
||||
return ((KProperty0) getReflected()).getDelegate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,9 @@ public abstract class PropertyReference1 extends PropertyReference implements KP
|
||||
public KProperty1.Getter getGetter() {
|
||||
return ((KProperty1) getReflected()).getGetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate(Object receiver) {
|
||||
return ((KProperty1) getReflected()).getDelegate(receiver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,9 @@ public abstract class PropertyReference2 extends PropertyReference implements KP
|
||||
public KProperty2.Getter getGetter() {
|
||||
return ((KProperty2) getReflected()).getGetter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDelegate(Object receiver1, Object receiver2) {
|
||||
return ((KProperty2) getReflected()).getDelegate(receiver1, receiver2);
|
||||
}
|
||||
}
|
||||
|
||||
+189
@@ -6861,6 +6861,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("getDelegateWithoutReflection.kt")
|
||||
public void testGetDelegateWithoutReflection() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getDelegateWithoutReflection.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("inClassVal.kt")
|
||||
public void testInClassVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/inClassVal.kt");
|
||||
@@ -18367,6 +18379,183 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class GetDelegate extends AbstractJsCodegenBoxTest {
|
||||
public void testAllFilesPresentInGetDelegate() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("booleanPropertyNameStartsWithIs.kt")
|
||||
public void testBooleanPropertyNameStartsWithIs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/booleanPropertyNameStartsWithIs.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("boundExtensionProperty.kt")
|
||||
public void testBoundExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundExtensionProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("boundMemberProperty.kt")
|
||||
public void testBoundMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/boundMemberProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionProperty.kt")
|
||||
public void testExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/extensionProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverride.kt")
|
||||
public void testFakeOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/fakeOverride.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("kPropertyForDelegatedProperty.kt")
|
||||
public void testKPropertyForDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/kPropertyForDelegatedProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("memberExtensionProperty.kt")
|
||||
public void testMemberExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberExtensionProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperty.kt")
|
||||
public void testMemberProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/memberProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashClassAndCompanion.kt")
|
||||
public void testNameClashClassAndCompanion() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashClassAndCompanion.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("nameClashExtensionProperties.kt")
|
||||
public void testNameClashExtensionProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/nameClashExtensionProperties.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("noSetAccessibleTrue.kt")
|
||||
public void testNoSetAccessibleTrue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/noSetAccessibleTrue.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("notDelegatedProperty.kt")
|
||||
public void testNotDelegatedProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/notDelegatedProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("overrideDelegatedByDelegated.kt")
|
||||
public void testOverrideDelegatedByDelegated() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/overrideDelegatedByDelegated.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperty.kt")
|
||||
public void testTopLevelProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/reflection/specialBuiltIns")
|
||||
|
||||
@@ -661,6 +661,7 @@ public abstract class kotlin/jvm/internal/MutablePropertyReference0 : kotlin/jvm
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Object;)V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate ()Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty0$Getter;
|
||||
public synthetic fun getSetter ()Lkotlin/reflect/KMutableProperty$Setter;
|
||||
@@ -681,6 +682,7 @@ public abstract class kotlin/jvm/internal/MutablePropertyReference1 : kotlin/jvm
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Object;)V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty1$Getter;
|
||||
public synthetic fun getSetter ()Lkotlin/reflect/KMutableProperty$Setter;
|
||||
@@ -700,6 +702,7 @@ public class kotlin/jvm/internal/MutablePropertyReference1Impl : kotlin/jvm/inte
|
||||
public abstract class kotlin/jvm/internal/MutablePropertyReference2 : kotlin/jvm/internal/MutablePropertyReference, kotlin/reflect/KMutableProperty2 {
|
||||
public fun <init> ()V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty2$Getter;
|
||||
public synthetic fun getSetter ()Lkotlin/reflect/KMutableProperty$Setter;
|
||||
@@ -742,6 +745,7 @@ public abstract class kotlin/jvm/internal/PropertyReference0 : kotlin/jvm/intern
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Object;)V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate ()Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty0$Getter;
|
||||
public fun invoke ()Ljava/lang/Object;
|
||||
@@ -759,6 +763,7 @@ public abstract class kotlin/jvm/internal/PropertyReference1 : kotlin/jvm/intern
|
||||
public fun <init> ()V
|
||||
public fun <init> (Ljava/lang/Object;)V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty1$Getter;
|
||||
public fun invoke (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
@@ -775,6 +780,7 @@ public class kotlin/jvm/internal/PropertyReference1Impl : kotlin/jvm/internal/Pr
|
||||
public abstract class kotlin/jvm/internal/PropertyReference2 : kotlin/jvm/internal/PropertyReference, kotlin/reflect/KProperty2 {
|
||||
public fun <init> ()V
|
||||
protected fun computeReflected ()Lkotlin/reflect/KCallable;
|
||||
public fun getDelegate (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public synthetic fun getGetter ()Lkotlin/reflect/KProperty$Getter;
|
||||
public fun getGetter ()Lkotlin/reflect/KProperty2$Getter;
|
||||
public fun invoke (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
@@ -1212,6 +1218,7 @@ public abstract interface class kotlin/reflect/KProperty$Getter : kotlin/reflect
|
||||
|
||||
public abstract interface class kotlin/reflect/KProperty0 : kotlin/jvm/functions/Function0, kotlin/reflect/KProperty {
|
||||
public abstract fun get ()Ljava/lang/Object;
|
||||
public abstract fun getDelegate ()Ljava/lang/Object;
|
||||
public abstract fun getGetter ()Lkotlin/reflect/KProperty0$Getter;
|
||||
}
|
||||
|
||||
@@ -1220,6 +1227,7 @@ public abstract interface class kotlin/reflect/KProperty0$Getter : kotlin/jvm/fu
|
||||
|
||||
public abstract interface class kotlin/reflect/KProperty1 : kotlin/jvm/functions/Function1, kotlin/reflect/KProperty {
|
||||
public abstract fun get (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public abstract fun getDelegate (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public abstract fun getGetter ()Lkotlin/reflect/KProperty1$Getter;
|
||||
}
|
||||
|
||||
@@ -1228,6 +1236,7 @@ public abstract interface class kotlin/reflect/KProperty1$Getter : kotlin/jvm/fu
|
||||
|
||||
public abstract interface class kotlin/reflect/KProperty2 : kotlin/jvm/functions/Function2, kotlin/reflect/KProperty {
|
||||
public abstract fun get (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public abstract fun getDelegate (Ljava/lang/Object;)Ljava/lang/Object;
|
||||
public abstract fun getGetter ()Lkotlin/reflect/KProperty2$Getter;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user