Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328793 - Wrong Javadoc in Button(...)
Summary: Wrong Javadoc in Button(...)
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-27 03:28 EDT by Dani Megert CLA
Modified: 2021-11-15 15:05 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-10-27 03:28:19 EDT
HEAD.

The Javadoc of Button(...) says:
    Style bits are also inherited from superclasses.
While this is mostly true it is not for this class as the set of allowed styles is entirely defined in the Javadoc of the Button class.

Also, the Javadoc should mention what happens when other/wrong style bits are set, e.g. SWT.NONE defaults back to SWT.PUSH.
Comment 1 Felipe Heidrich CLA 2010-10-27 10:01:58 EDT
(In reply to comment #0)
> HEAD.
> The Javadoc of Button(...) says:
>     Style bits are also inherited from superclasses.
> While this is mostly true it is not for this class as the set of allowed styles
> is entirely defined in the Javadoc of the Button class.

It is true for Button, button inherits the Styles  BORDER, LEFT_TO_RIGHT, RIGHT_TO_LEFT from Control.

Agreed ?

> Also, the Javadoc should mention what happens when other/wrong style bits are
> set, e.g. SWT.NONE defaults back to SWT.PUSH.

Usually we don't spec what happens when the toolkit is used the wrong way.
In button for example, passing NO_SCROLL you give a radio button. In short, if a wrong bit is passed in, we don't know what is going to happen.

What can be said is: If none of ARROW, CHECK, PUSH, RADIO, and TOGGLE is set, the button defaults to PUSH.
Comment 2 Dani Megert CLA 2010-10-27 10:17:56 EDT
(In reply to comment #1)
> (In reply to comment #0)
> > HEAD.
> > The Javadoc of Button(...) says:
> >     Style bits are also inherited from superclasses.
> > While this is mostly true it is not for this class as the set of allowed styles
> > is entirely defined in the Javadoc of the Button class.
>Agreed ?

Ah yes, true. I was mainly detecting and filing this bug because someone tried SWT.NONE which is legal since it is inherited. However, the behavior for this legal use is not documented.

> What can be said is: If none of ARROW, CHECK, PUSH, RADIO, and TOGGLE is set,
> the button defaults to PUSH.
OK.
Comment 3 Felipe Heidrich CLA 2010-11-05 12:26:59 EDT
(In reply to comment #2)
> Ah yes, true. I was mainly detecting and filing this bug because someone tried
> SWT.NONE which is legal since it is inherited. However, the behavior for this
> legal use is not documented.

Where do we say SWT.NONE is legal ?

Not sure if I want to say SWT.NONE->SWT.PUSH for button.
If I do that for button then it would make sense to do it for all other controls, for example:
in Text SWT.NONE->SWT.SINGLE
in Combo:  SWT.NONE->SWT.SIMPLE
etc
Comment 4 Dani Megert CLA 2010-11-05 13:10:24 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > Ah yes, true. I was mainly detecting and filing this bug because someone tried
> > SWT.NONE which is legal since it is inherited. However, the behavior for this
> > legal use is not documented.
> 
> Where do we say SWT.NONE is legal ?

The constructor says:

 * Style bits are also inherited from superclasses.

and Button inherits from Widget, which says:

 * <dt><b>Styles:</b></dt>
 * <dd>(none)</dd>
Comment 5 Felipe Heidrich CLA 2010-11-05 14:23:49 EDT
(In reply to comment #4)
>  * <dt><b>Styles:</b></dt>
>  * <dd>(none)</dd>

IMO the person who wrote that did not mean that SWT.NONE is a valid bit, it just means no style.

Car, since you are lot better than I in language skills, can you please decide what is the best way to make our java doc more clear.
Comment 6 Dani Megert CLA 2010-11-06 09:56:24 EDT
(In reply to comment #5)
> (In reply to comment #4)
> >  * <dt><b>Styles:</b></dt>
> >  * <dd>(none)</dd>
> 
> IMO the person who wrote that did not mean that SWT.NONE is a valid bit, it
> just means no style.
Well, I'm not going to debate what that person had in mind ;-)

SWT.NONE:
	 * A constant known to be zero (0), typically used in operations
	 * which take bit flags to indicate that "no bits are set".
This seems to fit fine with what's defined in 'Widget'.

==> simply remove the part in Javadoc that speaks about inheritance.
Comment 7 Eclipse Webmaster CLA 2019-09-06 16:04:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 8 Eclipse Genie CLA 2021-11-15 15:05:17 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.