<Swing Dev> Confusing method javax.swing.tree.DefaultTreeCellEditor.EditorContainer#EditorContainer()

Andrey Turbanov turbanoff at gmail.com
Wed Dec 23 12:58:32 UTC 2020


Hello.
I've found a very strange methodin class EditorContainer:
javax.swing.tree.DefaultTreeCellEditor.EditorContainer#EditorContainer()
Method name is the same as class name, but it's not a constructor. I
think it's not a good idea to have such methods. Javadoc and comment
on these method are agree with me :)
Also SpotBugs show warning "Apparent method/constructor confusion" on
this - https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#nm-apparent-method-constructor-confusion-nm-method-constructor-confusion

// This should not be used. It will be removed when new API is
// allowed.
/**
 * Do not use.
 */
public void EditorContainer() {
    setLayout(null);
}


I propose to deprecate this method. Probably for removal.


Andrey Turbanov


More information about the swing-dev mailing list