<Swing Dev> Problems with "type swallowing" in sub-interfaces of ListModel caused by adding Generics in Java 7

Walter Laan W.Laan at costengineering.eu
Tue Jan 18 12:04:17 UTC 2011


> There was an earlier article about efforts to update the JDK codebase
to use new features of the language. Ok, Generics aren't _that_ new but
some new classes/interfaces in Swing finally got generified in Java 7. 
> But is there a reason why javax.swing.ListModel was generified, but
not its sub-interfaces like ComboBoxModel?
> This "type swallowing" actually caused non-fixable compiler errors in
Scala, where the scala-swing package can't be built anymore against the
Java 7 code base.
> The relevant bug ticket in Scala's trac is
https://lampsvn.epfl.ch/trac/scala/ticket/3634

> Maybe Oracle has already some bug about it? (Didn't bother to look
since Oracle started to make more and more bug reports not visible
anymore.)
> Are there any ongoing efforts to add Generics to the remaining classes
of Swing? Swing seems to be one of the last places where Generics are
still missing in a few places ...

What I know of it: the use of generics by Swing is a volunteer effort by
Florian Brunner and his latest patch to generify ComboBoxModel has not
been accepted yet. See the topic [PATCH] 100153: Generics: JComboBox of
the swing-dev list (okt-nov 2010).

With JDK7 declared feature complete I do wonder what will happen - is it
going to ship with only a part of Swing implemented with generics?
https://bugs.openjdk.java.net/show_bug.cgi?id=100153 is marked as P3
which seems to be planned to be fixed
(http://openjdk.java.net/projects/jdk7/
Rampdown start: P1-P3 bugs only).

https://bugs.openjdk.java.net/show_bug.cgi?id=100029 is the bug for the
JList generics.

Hope that helps,
Walter Laan.



More information about the swing-dev mailing list