Hi Tom, I just received a copy of Joshua Bloch's book "Effective Java - Second Edition" this week (of course I already own a copy of the first edition ;-) ) and could read about the PECS mnemonic. :-)
I think you're right that in many cases a model is both a producer and a consumer, but I think in the case of the immutable ListModel, it's actually just a producer. As I said, I currently slightly favor variant #1 (flexibility) but I'm also fine if the decision is to follow variant #2 (consistency). -Florian Am Donnerstag, 12. März 2009 schrieb Tom Hawtin: > Alexander Potochkin wrote: > >> Hi Florian, > >> > >> I'd like more consistent variant #2 because of the > >> javax.swing.ComboBoxModel#setSelectedItem() method prevents to use > >> construction like "<? extends E>" in the JComboBox class (as you > >> noticed before)... > > > > I second Pavel, "<? extends E>" doesn't work well for getters/setters > > > > #2 is preferable > > Thirded. > > Remember Josh Bloch's PECS: Producers Extends; Consumers Super. > > A model is both a producer and a consumer, so we want <? extends E super > E>, i.e. <E>. > > Tom