Kotlin-android-extensions dont work with custom view with generic

I have a custom view like this

public class MyTextView<T> extends TextView{
    private List<T> mDatas;

    public MyTextView<T>  setPages(List<T> datas){
        mDatas = datas;
        return this;
    }
}

when i use kotlin-android-extensions there is an error

how could i solve the problem???

How do you specify generic type? Please show xml file.

i dont know how to specify generic type. so i cant solve the problem.
i use it just like the common Textview.
i think that the extensions plugin should support it
like this
import kotlinx.android.synthetic.main.<layout>.textview as TextView<Int>

If you just use MyTextView in xml layout, then it can’t deduce generic type argument <T>. It is the same in Java. The only solution is to extend MyTextView<T>, for example IntTextView which extends MyTextView<Int>, and use it in layout.

I’m afraid it’s not Kotlin related in any way.

if i dont use Kotlin-android-extensions,
i use MyTextView just like this :
var textview : MyTextView = findViewById(R.id.textView)
i dont need to extend MyTextView . so i think Kotlin-android-extensions should support some feature to solve the problem.

Again, you can’t use MyTextView directly in layout because it is generic class. Android will make it MyTextView<Nothing> because you can’t specify generic type in xml layout. And that’s why you can’t call your setPages with Int list, because T is deduced as Nothing, as you didn’t provide that information in layout.
It’s not related to Kotlin Android Extensions at all. It’s just how Android handles generics in xml layouts.

if i use Kotlin-android-extensions, i can’t use MyTextView directly in layout .
if i dont use Kotlin-android-extensions, i can use MyTextView directly in layout .

You will find other solutions about this question in this page.

CustomViewFlipper<TextView> customFlipper = 
            (CustomViewFlipper<TextView>) findViewById(R.id.customFlipper);

i can cast it to the correct generic type.
i my code, i use this solution to solve the problem.

now i just want to use Kotlin-android-extensions and don’t want to use extends to solve thie problem.