pakoito
02/08/2020, 5:11 PMGopal S Akshintala
02/08/2020, 5:24 PMGopal S Akshintala
02/08/2020, 5:24 PMGopal S Akshintala
02/08/2020, 5:27 PMGopal S Akshintala
02/08/2020, 5:27 PMclass SomeClass<out T>(val someOther: SomeOther<out T>) {
}
inline fun <reified T> body(p: () -> SomeClass<T>) {
SomeJava.fromPublisher(p().someOther, T::class.java)
}
Gopal S Akshintala
02/08/2020, 5:28 PMpublic class SomeOther<T> {
}
Gopal S Akshintala
02/08/2020, 5:29 PMpublic class SomeJava {
/*public static <T, P extends SomeOther<T>> void fromPublisher(P publisher, Class<T> elementClass) {
}*/ // This won't work 🔴
public static <T> void fromPublisher(@NotNull SomeOther<? extends T> someOther, @NotNull Class<T> java) {
} // This works ✅
}
pakoito
02/08/2020, 6:26 PMpakoito
02/08/2020, 6:26 PM