Delegate properties stdlib, take 2.

This commit is contained in:
Maxim Shafirov
2013-05-30 17:54:27 +04:00
parent a954508284
commit 58914cdf33
7 changed files with 236 additions and 256 deletions
@@ -3,8 +3,6 @@ package test.properties.delegation
import junit.framework.TestCase
import kotlin.test.*
import kotlin.properties.*
import kotlin.properties.delegation.*
import kotlin.properties.delegation.lazy.*
trait WithBox {
fun box(): String
@@ -27,8 +25,8 @@ class DelegationTest(): DelegationTestBase() {
}
public class TestNotNullVar<T>(val a1: String, val b1: T): WithBox {
var a: String by NotNullVar<String>()
var b by NotNullVar<T>()
var a: String by Delegates.notNull<String>()
var b by Delegates.notNull<T>()
override fun box(): String {
a = a1
@@ -61,4 +59,4 @@ class TestObservableProperty: WithBox, ChangeSupport() {
if (!result) return "fail: result should be true"
return "OK"
}
}
}