Kotlin-列表中的泛型参数-Java和Kotlin混合

Kotlin-列表中的泛型参数-Java和Kotlin混合,java,android,generics,parameters,kotlin,Java,Android,Generics,Parameters,Kotlin,我有以下问题。我有一个用Kotlin编写的接口,其中有一个侦听器: interface Listener { fun onCountriesSuccess(countries: List<CountrySupportDto>) fun onCountriesFailure(t: Throwable) } 接口侦听器{ 国家成功的乐趣(国家:列表) 国家失败的乐趣(t:可丢弃) } 我有一个Java类,它使用这个接口作为匿名实例: private Intera

我有以下问题。我有一个用Kotlin编写的接口,其中有一个侦听器:

interface Listener {

    fun onCountriesSuccess(countries: List<CountrySupportDto>)

    fun onCountriesFailure(t: Throwable)

}
接口侦听器{
国家成功的乐趣(国家:列表)
国家失败的乐趣(t:可丢弃)
}
我有一个Java类,它使用这个接口作为匿名实例:

private InteractorCountriesNetwork.Listener getCountriesInteractorListener() {
return new InteractorCountriesNetwork.Listener() {
  @Override
  public void onCountriesSuccess(List<CountrySupportDto> countryRealmList) {
    if (view != null) {
      view.updateCountriesList(countryRealmList);
      view.hideProgress();
    }
  }

  @Override
  public void onCountriesFailure(Throwable t) {
    if (view != null) {
      view.showFailure(t);
    }
  }
};
}
private interactiorcountriesnetwork.Listener getCountriesInteractorListener(){
返回新的InteractiorCountriesNetwork.Listener(){
@凌驾
public void onCountriesSuccess(列出countryRealmList){
如果(视图!=null){
view.updateCountriesList(countryRealmList);
view.hideProgress();
}
}
@凌驾
国家失效时的公共无效(可丢弃的t){
如果(视图!=null){
视图。showFailure(t);
}
}
};
}
Android studio抱怨这种方法签名:

@Override
public void onCountriesSuccess(List<CountrySupportDto> countryRealmList) {
  ...
}
@覆盖
public void onCountriesSuccess(列出countryRealmList){
...
}
投诉如下:

“从(…).Listener派生的匿名类”中的“OnCounterSuccess(List)”与(…).Listener中的“onCountriesSuccess(List<?Extended CountrySupportDto>)”冲突;两种方法具有相同的擦除,但都不覆盖另一种方法


你能告诉我这个代码有什么问题吗?此外,不幸的是,该类必须用Java实现。

更改Java方法的签名以获取
列表我尝试了您的代码,它似乎工作得非常好。我使用gradle 4和IntelliJ。当您使用gradle
/gradlew clean build--info
构建它时,是否存在同样的问题?