<@U3DE1TXKP> what are you trying to achieve?
# announcements
a
@robstoll what are you trying to achieve?
r
I have two functions, one expects T (which is defined as T: Any?) and another can only work for T without nullable. Currently the second has a null check in it and calls other methods which have to do the null check as well, which call other methods which have to do the null-check as well etc. etc. I would like to specify that the method expects T2: T but without nullable. I have a solution like this: class A<T2 : Any, T: T2?> where I am using T2 for the second method. But the additional type parameter seems so unnecessary
a
@robstoll are those methods in the same class and you have full control over your class?
r
@Andreas Sinz I have somewhat full control, but for simplicity we can say I have full control
a
@robstollthen the following should work just fine:
Copy code
class A<T: Any> {
    fun aNullable(t: T?) { } //*t* is nullabe here

    fun aNotNullable(t: T) { } //*t* is NOT nullable here
}