我有:
public abstract class V {}
public class PV extends V {}
public class TV extends V {}
我也有:
ListView<? extends V> listView = new ListView<>();
当我尝试:
listView.setCellFactory(new Callback<ListView<? extends V>, ListCell<? extends V>>() {
@Override
.............
});
我收到错误警告:
Incompatible types:
anonymous Callback<ListView<? extends V>, ListCell<? extends V>>
cannot be converted to Callback<ListView<CAP#1>, ListCell<CAP#!>>
where CAP#1 is fresh type-variable:
CAP#1 extends V from capture of ? extends V
我试过了:
new Callback<ListView<V>, ListCell<V>>()
那并没有解决这个问题。
为什么我会收到该消息,有什么办法可以解决它?