I don't think the generification of javax.swing.event.EventListenerList is
correct:
$ javac -source 1.4 Test.java
$ javac -source 5 Test.java
Test.java:7: <T>add(java.lang.Class<T>,T) in javax.swing.event.EventListenerList cannot be applied to (java.lang.Class<capture of ? extends java.util.EventListener>,java.util.EventListener)
list.add(l.getClass(), l);
^
1 error
$ cat -n Test.java
1 import java.util.EventListener;
2 import javax.swing.event.EventListenerList;
3
4 class Test {
5 void test(EventListenerList list, EventListener l)
6 {
7 list.add(l.getClass(), l);
8 }
9 }
This is not a compiler bug. The declaration of add should probably have been:
<T extends EventListener> void add(Class<? extends T> t, T l);
I think the remove method has the same problem.
###@###.### 10/26/04 05:21 GMT