Failed type inference


Kotlin: Type parameter bound for T in fun <T> setAdapter(adapter : T?) : Unit where T : android.widget.ListAdapter?, T : android.widget.Filterable? is not satisfied: inferred type ArrayAdapter<String> is not a subtype of {ListAdapter & Filterable}?

is generated by


val adapter = ArrayAdapter<String>(this, org.holoeverywhere.R.layout.simple_dropdown_item_1line, names)
val completion = findViewById( as AutoCompleteTextView

setAdapter definition is below

public <T extends android.widget.ListAdapter & android.widget.Filterable>  void setAdapter(T adapter) { /* compiled code */ }

ArrayAdapter definition is as follow


public class ArrayAdapter<T> extends BaseAdapter implements Filterable

public abstract class BaseAdapter implements android.widget.ListAdapter, android.widget.SpinnerAdapter {


My workaround is to implement the same code in Java and use it in Kotlin class


package com.silverkeytech.android_rivers.creators;

import org.holoeverywhere.ArrayAdapter;
import org.holoeverywhere.widget.AutoCompleteTextView;

import java.util.ArrayList;

public class AirportAutoComplete {
  public static AutoCompleteTextView getUI(Activity context, Integer uiId, ArrayList<String> names){
  AutoCompleteTextView completion = (AutoCompleteTextView) context.findViewById(uiId);
  ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, org.holoeverywhere.R.layout.simple_dropdown_item_1line, names);
  return completion;


Could you please post a bug about it? Thank you.