<Swing Dev> 6179357: Generics: JList: Constructors & Model

Tom Hawtin Thomas.Hawtin at Sun.COM
Thu Mar 12 16:56:49 UTC 2009


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



More information about the swing-dev mailing list