Ben
Ben

Reputation: 57287

Java warning - JList is a raw type, references must be parameterized

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

Upvotes: 6

Views: 8760

Answers (2)

WhyNotHugo
WhyNotHugo

Reputation: 9924

JList is a raw type as of Java 1.7, the same goes for a couple more of swing components. Your x86 and x64_86 enviroments probably have diferent versions of java, that's why you're getting the warning in one, and no warning in the other.

Upvotes: 3

Eng.Fouad
Eng.Fouad

Reputation: 117645

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");

Upvotes: 9

Related Questions