Bug 4772 - Javadoc: Graphics constructors need to doc if device null (1GHSPUW)
Summary: Javadoc: Graphics constructors need to doc if device null (1GHSPUW)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:22 EDT by Carolyn MacLeod CLA
Modified: 2002-06-17 16:43 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2001-10-11 14:22:44 EDT
Color, Cursor, Font, Image.
	Constructors all take a device, which is technically not supposed to be null.
	Except that we had to allow null for now (or else break lots of code).
	So if the app passes in null for the device, we use the current device (the display).

	If we ever figure out what we want to do here, we need to fix all of the graphics constructors that take device
	so that they 'fess up to the nullpointer exception, i.e. something like:

 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if device is null [and there is no current device]</li>
 * </ul>


NOTES:
Comment 1 DJ Houghton CLA 2001-10-29 16:37:25 EST
PRODUCT VERSION:
	0.9

Comment 2 Mike Wilson CLA 2001-12-10 13:58:35 EST
SN to ensure the required discussion happens... Look for RFC template.
Comment 3 Steve Northover CLA 2002-06-06 14:10:33 EDT
I don't think we can change this ever (I'm sorry).  Go ask Silenio.  Do we 
silently take null now?
Comment 4 Carolyn MacLeod CLA 2002-06-06 14:24:17 EDT
Here is the typical code pattern:

	if (device == null) device = Device.getDevice();
	if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);

So quite likely, we will never throw.
But it looks like we could.
Comment 5 Silenio Quarti CLA 2002-06-07 10:36:08 EDT
I think we cannot remove the line below anymore (argh!!), but
we should mention in the comment that we are going to throw
ERROR_NULL_ARGUMENT if the device is null and we cannot get the
default. Maybe people will stop passing null, when they see the
comment.

	if (device == null) device = Device.getDevice();
Comment 6 Steve Northover CLA 2002-06-17 16:43:00 EDT
This has been documented by CAR.