-
Notifications
You must be signed in to change notification settings - Fork 164
Refactor Image for Readability #1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Image for Readability #1667
Conversation
Test Results 382 files ±0 382 suites ±0 6m 44s ⏱️ - 1m 1s For more details on these failures and errors, see this check. Results for commit 231cd1e. ± Comparison against base commit 62ad8d9. ♻️ This comment has been updated with latest results. |
22e154f
to
035b5c4
Compare
This commit refactors usage of ImageDataProvider and ImageFilenameProvider to make the code more readable. contributes to eclipse-platform#62 and eclipse-platform#127
035b5c4
to
c7485f0
Compare
- Rename AbstractImageProvider to AbstractImageProviderWrapper - Changed equals implemenation (made it shorter) - Added Objects.requireNonNull to constructors in subclasses of AbstractImageProviderWrapper - Changed return type of method createCopy(...) in subclasses
- Remove class StaticZoomUpdater
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amartya4256 I made some changes in 2 extra commits so you can review it better.
Here are my changes:
-
Rename AbstractImageProvider to AbstractImageProviderWrapper
-
Changed equals implemenation (made it shorter)
-
Added Objects.requireNonNull to constructors in subclasses of AbstractImageProviderWrapper
-
Changed return type of method createCopy(...) in subclasses
-
Remove class StaticZoomUpdater (separate commit)
The part I would like you to check and validate/revert is the one about adding Objects.requireNonNull(...)
to constructors since I can only assume that the provider
s that the subclasses hold are never null
. My assumption is merely based on the fact that you didn't check for null
in the equals(...)
/ hashCode()
methods in those subclasses, but if you are not sure about this then please add null-checks to those methods and remove Objects.requireNonNull(...)
from the constructors.
The ball is on your side again and therefore I marked this PR as "changes requested" ;-)
It looks good to go. |
In inner classes of Image. Fixes eclipse-platform#1667
In inner classes of Image. Fixes eclipse-platform#1667
These 2 tests in
The exception is: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:233)
at org.eclipse.swt.graphics.Image$ImageDataProviderWrapper.<init>(Image.java:2114)
at org.eclipse.swt.graphics.Image.<init>(Image.java:592)
... I created a PR to fix them: #1688 |
In inner classes of Image. Fixes #1667
This contribution refactors the Image class to improve readability. The following refactoring have been done:
contributes to #62 and #127