# HG changeset patch # User David Barts <n5jrn@me.com> # Date 1586742417 25200 # Node ID 539c3641c5390ba7792d4b91fd111347851d9be7 # Parent 965435b85a69ef3b3be674c9ee0a91a3179a83e0 Input type to SetOnceImpl cannot be nullable. diff -r 965435b85a69 -r 539c3641c539 src/name/blackcap/exifwasher/Misc.kt --- a/src/name/blackcap/exifwasher/Misc.kt Sun Apr 12 11:46:12 2020 -0700 +++ b/src/name/blackcap/exifwasher/Misc.kt Sun Apr 12 18:46:57 2020 -0700 @@ -23,7 +23,7 @@ * needed in Swing, because some vars inevitably need to be declared at * outer levels but initialized in the Swing event dispatch thread. */ -class SetOnceImpl<T>: ReadWriteProperty<Any?,T> { +class SetOnceImpl<T: Any>: ReadWriteProperty<Any?,T> { private var setOnceValue: T? = null override operator fun getValue(thisRef: Any?, property: KProperty<*>): T { @@ -43,7 +43,7 @@ } } -fun <T> setOnce(): SetOnceImpl<T> = SetOnceImpl<T>() +fun <T: Any> setOnce(): SetOnceImpl<T> = SetOnceImpl<T>() /** * Run something in the Swing thread, asynchronously.