对具有相同返回类型的方法的未选中赋值警告

时间:2018-05-02 17:16:38

标签: java list intellij-idea

在班级public List<Vertice<T>> getVertices()中,我有以下方法:

GrafoGOT

然后在子类List<Vertice> vertices = this.getVertices();中我正在尝试执行以下任务:

Unchecked assignment

但我在某种程度上在Intellij IDEA中遇到# dnf install libcurl-devel.x86_64错误。

为什么我收到错误,我应该怎么做才能将其删除?

1 个答案:

答案 0 :(得分:4)

将作业陈述更改为

List<Vertice<T>> vertices = this.getVertices();

Vertice是通用类型。

如果GrafoGOT类声明不像

那样通用
class GrafoGOT extends Grafo<String> {}

然后赋值语句将更改为

List<Vertice<String>> vertices = this.getVertices();
相关问题