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

Robert Gibson robbiexgibson at yahoo.com
Thu Jul 31 12:54:46 UTC 2014


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