小编kot*_*ese的帖子

Java泛型"捕获?"

我正在和一个工作人员一起工作TreeTable时,我需要通过一个

Callback<TreeTableColumn<A, capture of ?>, TreeTableCell<A, capture of ?>>
Run Code Online (Sandbox Code Playgroud)

A是我正在使用的课程,但我不知道如何处理"捕获?"

我试图创造

new Callback<TreeTableColumn<A, ?>, TreeTableCell<A, ?>>
Run Code Online (Sandbox Code Playgroud)

但IDEA显示出警告

setCellFactory(Callback<TreeTableColumn<A, capture<?>>, TreeTableCell<A, capture<?>>>) in TreeTableColumn cannot be applied to (anonymous Callback<TreeTableColumn<A, ?>, TreeTableCell<A, ?>>)
Run Code Online (Sandbox Code Playgroud)

我尝试使用特定的类(如String)而不是"?" 同样,但没有任何帮助.

谁能向我解释如何使用它?

谢谢.

编辑:

我聚集了一点点信息.该CellFactoryTreeTableColumn<S,T>应该是Callback<TreeTableColumn<S,T>,TreeTableCell<S,T>>但是,我与原始类型创建工作(在库)的TreeTableColumn.

使用原始类型回调有效.但有没有其他选择如何解决这个问题?

java generics wildcard capture

21
推荐指数
1
解决办法
2万
查看次数

标签 统计

capture ×1

generics ×1

java ×1

wildcard ×1