<Swing Dev> Fw: JDK 9 RFR of JDK-8043550 : Fix raw and unchecked lint warnings in javax.swing.*

Robert Gibson robbiexgibson at yahoo.com
Tue Aug 5 07:34:05 UTC 2014


Hi Joe,
Sorry, I replied to this mailing list message but realised afterwards that you're not a list subscriber ...
Regards,
Robert


On Thursday, 31 July 2014, 14:54, Robert Gibson <robbiexgibson at yahoo.com> wrote:
On Mon Jun 30 16:20:50 UTC 2014, Joe Darcy <joe.darcy at oracle.com> wrote:


> It was not immediately clear how javax.swing.tree.TreeNode.children(), 
> which returns a raw Enumeration, should be generified. I changed it to
> Enumeration<TreeNode> children(); and that seems to work fine. Something like
> Enumeration<? extends TreeNode> with a covariant override would save a few casts in a private 
> implementation, but generally doesn't seem to be a good trade-off since 
> many normal clients could be inconvenienced dealing with the wildcard. 

Hi Joe,
We have a few implementations of TreeNode that look like this:

class MyTreeNode implements TreeNode {
  public Enumeration<MyTreeNode> children() { ... }
}

They don't compile any more after the change to TreeNode. Maybe something like this would have fewer compatibility issues?

public interface TreeNode<C extends TreeNode>
{
  ...
  Enumeration<C> children();
  ...
}

Regards,
Robert 



More information about the swing-dev mailing list