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

2

6

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
Winter answered 12/12, 2011 at 4:29 Comment(1)
Similar question: #2770821Sclerotic
O
9

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");
Opinionated answered 12/12, 2011 at 4:32 Comment(0)
M
3

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.

Margarethe answered 26/3, 2012 at 12:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.