pawel.urban
09/12/2018, 9:43 AMSomeClass<X> and SomeClass<X?> at once?Nikky
09/12/2018, 9:47 AMpawel.urban
09/12/2018, 9:48 AMpawel.urban
09/12/2018, 9:50 AMNikky
09/12/2018, 9:51 AMfun <T: Any> SomeClass<T?>.something()robstoll
09/12/2018, 9:52 AM? explicitly?robstoll
09/12/2018, 9:53 AMX without upper boundrobstoll
09/12/2018, 9:53 AMX: Any?Nicolas Chaduc
09/12/2018, 9:54 AMSomeClass why handle `T?`not the extension method.Nikky
09/12/2018, 9:54 AMpawel.urban
09/12/2018, 9:55 AMun <T: Any> SomeClass<T?>.something(): SomeClass<T or T?> depending on extended classpawel.urban
09/12/2018, 9:56 AMNikky
09/12/2018, 9:56 AMvalue: T = argument ?: throw IllegalStateException()
might be possible
(i don't think i ever tried though .. or i do not remember)Nicolas Chaduc
09/12/2018, 9:58 AMSomeClass.myExtension<X?>()diesieben07
09/12/2018, 9:59 AMSomeClass<String> to yield SomeClass<String?> but SomeClass<Int> to yield SomeClass<Int>? Or what exactly do you want?pawel.urban
09/12/2018, 10:08 AMSomeClass<String> and SomeClass<String?> which I’d like to extend and the extension would accordingly return SomeClass<String> and SomeClass<String?>, depending on the extended type.
I’m wondering if I can have just one extension in which internally I would handle potential nullability.diesieben07
09/12/2018, 10:10 AMfun <T> SomeClass<T>.foo(): SomeClass<T>
If you call foo on a SomeClass<String> it will return SomeClass<String> and if you call it on SomeClass<String?> it will return SomeClass<String?>.diesieben07
09/12/2018, 10:11 AMfun <T : String?> SomeClass<T>.foo(): SomeClass<T> - In this case only String or String? could be used for T.pawel.urban
09/12/2018, 10:12 AMpawel.urban
09/12/2018, 10:18 AM