Introduce KClass.members, make properties/extensionProperties extensions

To avoid significant growth of KClass and KPackage interfaces
This commit is contained in:
Alexander Udalov
2015-07-08 03:13:40 +03:00
parent 2492977274
commit 50dbda1e1a
19 changed files with 80 additions and 54 deletions
@@ -1,4 +1,5 @@
import kotlin.reflect.jvm.kotlin
import kotlin.reflect.*
class A {
var String.id: String
@@ -1,4 +1,4 @@
import kotlin.reflect.KMutableProperty2
import kotlin.reflect.*
import kotlin.test.assertEquals
class C(var state: String) {
@@ -1,10 +1,10 @@
import kotlin.reflect.KProperty1
import kotlin.reflect.*
class A<T> {
val result = "OK"
}
fun box(): String {
val k : KProperty1<A<*>, *> = A::class.properties.single()
val k: KProperty1<A<*>, *> = A::class.properties.single()
return k.get(A<String>()) as String
}
@@ -1,5 +1,5 @@
import kotlin.reflect.jvm.kotlin
import kotlin.reflect.KMutableProperty2
import kotlin.reflect.*
var storage = "before"
@@ -1,5 +1,5 @@
import kotlin.reflect.jvm.kotlin
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.*
class A(val readonly: String) {
var mutable: String = "before"
@@ -1,6 +1,5 @@
import kotlin.reflect.jvm.kotlin
import kotlin.reflect.KProperty1
import kotlin.reflect.KProperty2
import kotlin.reflect.*
class A {
val foo: String = "member"
@@ -1,5 +1,4 @@
import kotlin.reflect.IllegalPropertyAccessException
import kotlin.reflect.KProperty1
import kotlin.reflect.*
import kotlin.reflect.jvm.accessible
class Result {
@@ -1,5 +1,4 @@
import kotlin.reflect.IllegalPropertyAccessException
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.*
import kotlin.reflect.jvm.accessible
class A {
@@ -1,3 +1,5 @@
import kotlin.reflect.*
open class A(private val p: Int)
class B : A(42)
@@ -1,6 +1,5 @@
import kotlin.reflect.IllegalPropertyAccessException
import kotlin.reflect.*
import kotlin.reflect.jvm.accessible
import kotlin.reflect.KMutableProperty1
class A(param: String) {
protected var v: String = param
@@ -1,3 +1,4 @@
import kotlin.reflect.*
import kotlin.reflect.jvm.kotlin
class A(param: String) {