DESCRIPTION

Bug 521489 - Initializing Rectangle vars with empty instance

Change-Id: I5f3d3b6e7814f9e18cdfb38d401b28437664408a
Signed-off-by: Armani Hurst xxx@xxx.xxx


COMMENTS

author: Isis Velasquez
date: 2017-09-07 06:39:21.000000000

Patch Set 3: Patch Set 2 was rebased

-------------------------------------
author: Brenden Conley
date: 2017-09-07 06:39:29.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13429/

-------------------------------------
author: Isis Velasquez
date: 2017-09-07 06:44:48.000000000

Patch Set 3: Code-Review-1

I don't get how this patch is fixing the NPE in `composite.getDisplay().getSystemCursor(SWT.CURSOR_SIZESW)` that was reported in the related bug.

-------------------------------------
author: Armani Hurst
date: 2017-09-07 07:04:16.000000000

Patch Set 3:

> I don't get how this patch is fixing the NPE in `composite.getDisplay().getSystemCursor(SWT.CURSOR_SIZESW)`
 > that was reported in the related bug.

The rectangles are null until layout() ist called. This does not seem to happen before, thus the setCursor() method will run into a NPE. When the rectangles are initialized as in this change, the variables won't ever be null and setCursor() does not raise the NPE. Instead, it will run into the last else-block and call setCursor(null), which does not harm.

-------------------------------------
author: Brenden Conley
date: 2017-09-07 07:10:47.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/13429/ : SUCCESS

-------------------------------------
author: Isis Velasquez
date: 2017-09-07 07:28:03.000000000

Patch Set 3: Code-Review+1

Ok, thanks for the explanation. And out of curiosity, why initial values rather than null-checks?

-------------------------------------
author: Armani Hurst
date: 2017-09-07 07:34:16.000000000

Patch Set 3:

> Ok, thanks for the explanation. And out of curiosity, why initial
 > values rather than null-checks?

The fields are also used at other locations (mouseDown()) without null check and would potentially also fail. However, just theoretical since there is no problem report related to that.

I think this code looks cleaner than having all the null checks.

-------------------------------------
author: Isis Velasquez
date: 2017-09-07 07:35:03.000000000

Patch Set 3: Code-Review+2

Sold ;)

-------------------------------------
author: Isis Velasquez
date: 2017-09-07 07:35:11.000000000

Change has been successfully merged by Isis Velasquez

-------------------------------------
author: Armani Hurst
date: 2017-09-07 10:16:08.000000000

Patch Set 3: Cherry Picked

This patchset was cherry picked to branch R4_7_maintenance as commit 88db0a4984279723b841b5ad6e8818f1c0eacd27

-------------------------------------
