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 <[email protected]> wrote:
On Mon Jun 30 16:20:50 UTC 2014, Joe Darcy <[email protected]> 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

Reply via email to