<Swing Dev> Confusing method javax.swing.tree.DefaultTreeCellEditor.EditorContainer#EditorContainer()
Philip Race
philip.race at oracle.com
Wed Dec 23 16:04:57 UTC 2020
Thanks for raising a discussion first.
This looks like a mistake from over 20 years ago :
https://bugs.openjdk.java.net/browse/JDK-4198051
I do not know why it was not deprecated then (or soon afterwards)
but I think it OK to at least add @Deprecated.
I usually hesitate over for removal especially in really old commonly used
classes until there is a good sense of what the impact would be on lots of
apps for which people may not even have all the source any more (eg they
used
a 3rd party library).
-phil.
On 12/23/20 4:58 AM, Andrey Turbanov wrote:
> 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