changeset 50:3f8409470fdf

Input type to SetOnceImpl cannot be nullable.
author David Barts <n5jrn@me.com>
date Sun, 12 Apr 2020 18:45:23 -0700
parents bb80148e2cb3
children e8d2a7e6f6c7
files src/name/blackcap/clipman/Misc.kt
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Misc.kt	Sun Apr 12 17:03:11 2020 -0700
+++ b/src/name/blackcap/clipman/Misc.kt	Sun Apr 12 18:45:23 2020 -0700
@@ -26,7 +26,7 @@
  *
  * @param &lt;T&gt; type of the associated value
  */
-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 {
@@ -50,7 +50,7 @@
  * Normal way to create a setOnce var:
  * var something: SomeType by setOnce()
  */
-fun <T> setOnce(): SetOnceImpl<T> = SetOnceImpl<T>()
+fun <T: Any> setOnce(): SetOnceImpl<T> = SetOnceImpl<T>()
 
 /**
  * Run something in the Swing thread, asynchronously.