简体   繁体   中英

AbstractListModel is not generic with jdk 1.6.0_45

I'd like to define a Swing combobox model as follows:

public class SchemaGroupModel<E> extends AbstractListModel<E> implements ComboBoxModel<E>

but Eclipse raises the error (twice):

The type AbstractListModel is not generic; it cannot be parameterized with arguments <E>

I checked here (raw type definition), here (old JDKs) and here (position of JDK library in the Java Build path). From these replies I guess that the problem should be the version of the JDK or its position in the IDE's libraries. But I doubled checked: I'm using JDK 1.6 and such library comes before Maven dependencies.

Eclipse's screenshot

What am I doing wrong?

This class wasn't generic in Java 6

https://docs.oracle.com/javase/6/docs/api/javax/swing/AbstractListModel.html

public abstract class AbstractListModel
extends Object
implements ListModel, Serializable

you can see that in Java 7 it was made generic.

https://docs.oracle.com/javase/7/docs/api/javax/swing/AbstractListModel.html

public abstract class AbstractListModel<E>
extends Object
implements ListModel<E>, Serializable

however, if you are going to update, I suggest using Java 8 as Java 7 is EOL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM