在代码末尾这个错误是什么问题?尝试了许多修复,但没有任何帮助https://i.stack.imgur.com/jwosT.png
return (List<String>) ImmutableList.of();
问题在于,ImmutableList.of()
的类型是在应用强制转换之前确定的。
在该上下文中ImmutableList.of()
的类型是ImmutableList<Object>
。ImmutableList<Object>
不是ImmutableList<String>
。
我很惊讶你需要任何类型的提示在这里:
return ImmutableList.of();