Java警告-JList是原始类型,必须对引用进行参数化 [英] Java warning - JList is a raw type, references must be parameterized
本文介绍了Java警告-JList是原始类型,必须对引用进行参数化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人能从Eclipse发出以下警告吗?
Can someone shed more light the following warning from Eclipse:
JList is a raw type. References to generic type JList<E> should be parameterized.
触发这一行的代码可能是:
A line of code triggering this could be:
import javax.swing.JList;
....
private JList jList = null; // Warning on this line
推荐答案
您应将元素的类型放在<>之间,例如:
You should put the type of the elements between <>, for example:
List<String> list = new ArrayList<String>();
list.add("String 1");
list.add("Some Text");
这篇关于Java警告-JList是原始类型,必须对引用进行参数化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文