Question about generics. Having this code: ```// ...
# getting-started
g
Question about generics. Having this code:
Copy code
// all T - java classes implementing ViewDataBinding, each providing a static `bind` method
// ViewDataBinding - a Java abstract class (with no declaration of `bind`)

interface BindingAware<T : ViewDataBinding> {
    var f: T

    fun bind(v: View) {
        // f = T.bind(a)  // <= how to call static method provided by class behind T?
    }
}
How to call static method of T, having only T?
r
I don't see how you can. Firstly static methods are not part of the signature of a class in that way - you can't declare an abstract static method on
ViewDataBinding
. But even if
bind
were an instance method, if it wasn't defined on
ViewDataBinding
then it would be purely convention that all subclasses of
ViewDataBinding
had one, not something the static type checker could rely on and prove. I see this is an Android class - might be worth asking in #android or even #android-databinding how people have solved what you are trying to do?