voohbar
05/30/2023, 5:55 PMinline fun <reified T> foo(): Boolean {
val isTNullable = false // TODO
return isTNullable
}
voohbar
05/30/2023, 5:59 PMnull is T
is the solutionCLOVIS
05/31/2023, 8:17 AMAny?
: <T>
is the same as <T : Any?>
If you want to accept any non-null value, you can use <T : Any>
instead.
Reified type parameters don't change this, so you can do <reified T : Any>
pour a reified type parameter which cannot be null
.