I have the following interface method definition written in Java:
<T extends View & ISpecificView> T getSpecificView(); A Java-based consumer code is able to operate on this method simply by invoking it and treat the returned value as an object extending the View class and implementing the ISpecificView interface the following way:
getContainer().getSpecificView().whateverTclassMethod() Trying to invoke the same code in Kotlin I get the Type inference failed: Not enough information to infer parameter T (...) Please specify it explicitly error on the getSpecificView() method. I'd love to provide the type explicitly, but I'm unable to pass any specific class, since it may be any ancestor of the View class that implements the ISpecificView interface. Passing either single View or ISpecificView does not help - it results in the Type argument is not within its bounds. Expected: View! Found ICustomView and vice versa.
Is there any possibility to pass an equivalent to Java's T extends View & ISpecificView in Kotlin while calling a method, so I can make use of it?