Closed
Bug 845612
Opened 13 years ago
Closed 13 years ago
Override All The Things
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 22
People
(Reporter: bnicholson, Assigned: bnicholson)
Details
Attachments
(2 files)
|
78.26 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
|
244.59 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
We should use @Override whenever possible to make overriding explicit. This helps make the code more readable, and it also reduces the potential for errors if methods are renamed or changed.
Attachment #718771 -
Flags: review?(bugmail.mozilla)
| Assignee | ||
Comment 1•13 years ago
|
||
It's also good practice to use @Override for implemented interface methods, so this patch does that.
Attachment #718816 -
Flags: review?(bugmail.mozilla)
Comment 2•13 years ago
|
||
Comment on attachment 718771 [details] [diff] [review]
Add missing @Override annotations
Review of attachment 718771 [details] [diff] [review]:
-----------------------------------------------------------------
\o/
Attachment #718771 -
Flags: review?(bugmail.mozilla) → review+
Comment 3•13 years ago
|
||
Comment on attachment 718816 [details] [diff] [review]
Add @Overrides annotations for implemented interfaces
Review of attachment 718816 [details] [diff] [review]:
-----------------------------------------------------------------
Not sure this is really needed since typoing these function names will result in a compilation failure anyway. But r+ since you've already done all the work :)
::: mobile/android/base/FindInPageBar.java
@@ +68,5 @@
> } else {
> // showSoftInput won't work until after the window is focused.
> mFindText.setOnWindowFocusChangeListener(new CustomEditText.OnWindowFocusChangeListener() {
> + @Override
> + public void onWindowFocusChanged(boolean hasFocus) {
indentation
Attachment #718816 -
Flags: review?(bugmail.mozilla) → review+
| Assignee | ||
Comment 4•13 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)
> Comment on attachment 718816 [details] [diff] [review]
> Add @Overrides annotations for implemented interfaces
>
> Review of attachment 718816 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Not sure this is really needed since typoing these function names will
> result in a compilation failure anyway. But r+ since you've already done all
> the work :)
Yeah, it does seem a bit overkill in certain places (especially when implementing single method interfaces like Runnable.run()). But there are some cases where it should help readability; namely, anywhere we lump in interface implementations with other methods, like http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/TabsTray.java#156 or http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/TabsTray.java#259, since it's not obvious just from glancing at the code.
In case you're curious, I made these patches using Eclipse's code cleanup tools (thanks to romaxa's Eclipse project generation scripts).
| Assignee | ||
Comment 5•13 years ago
|
||
Comment 6•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ed22faa72a82
https://hg.mozilla.org/mozilla-central/rev/7164bd42720f
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•