不兼容的类型:List <object>无法转换为List <! - ?扩展Serializable - >

时间:2017-09-12 06:01:30

标签: java generics casting compiler-errors

当我运行&#39; gradle&#39; compileJava,我遇到了这个错误:

incompatible types: List<Object> cannot be converted to List<? extends Serializable>

我的代码在eclipse中很好,并且在eclipse和同样的JVM 1.8.0_112中构建得很好:

List<Object> resultList = new ArrayList<Object>();
List<? extends Serializable> searchResults ; 
searchResults = (List<? extends Serializable>) resultList;

Gradle 4.1 with JVM 1.8.0_112(Oracle Corporation 25.112-b15) 使用sourceCompatibility = '1.8'

构建

enter image description here

0 个答案:

没有答案