Clean up Java imports

RESOLVED FIXED in Firefox 17

Status

()

Firefox for Android
General
P4
normal
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

Trunk
Firefox 17
ARM
Android
Points:
---

Firefox Tracking Flags

(firefox16 wontfix, firefox17 fixed)

Details

Attachments

(3 attachments)

Comment hidden (empty)
(Assignee)

Comment 1

5 years ago
Created attachment 646892 [details] [diff] [review]
part-1-remove-unused-imports.patch

Part 1: Remove unused and redundant import statements.
Attachment #646892 - Flags: review?(mark.finkle)
(Assignee)

Comment 2

5 years ago
Created attachment 646894 [details] [diff] [review]
part-2-replace-wildcard-imports.patch

Part 2: Replace wildcard import statements with fully-qualified names, as per Google's style guide for Android Java code. This makes tracking dependencies and finding unused import statements easier.

https://source.android.com/source/code-style.html#fully-qualify-imports
Attachment #646894 - Flags: review?(mark.finkle)
(Assignee)

Comment 3

5 years ago
I have a patch part 3 that cleans up our haphazard ordering of import statements, but I am waiting for feedback from m.d.p.m. re the correct order.
Comment on attachment 646892 [details] [diff] [review]
part-1-remove-unused-imports.patch

Are you using a tool to help with this or just eye-balling it? Tools like PMD and FindBugs will find this bad imports too.
Attachment #646892 - Flags: review?(mark.finkle) → review+
Attachment #646894 - Flags: review?(mark.finkle) → review+
(Assignee)

Comment 5

5 years ago
(In reply to Mark Finkle (:mfinkle) from comment #4)
> Are you using a tool to help with this or just eye-balling it? Tools like
> PMD and FindBugs will find this bad imports too.

I'm using Checkstyle: http://checkstyle.sourceforge.net/
(Assignee)

Updated

5 years ago
Whiteboard: [leave open]
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/8cad55a9891f
https://hg.mozilla.org/integration/mozilla-inbound/rev/034d26a9a873

Comment 7

5 years ago
https://hg.mozilla.org/mozilla-central/rev/8cad55a9891f
https://hg.mozilla.org/mozilla-central/rev/034d26a9a873
(Assignee)

Comment 8

5 years ago
Created attachment 647681 [details] [diff] [review]
part-3-standardize-import-order.patch

Part 3: Standardize order of import statements from most project-specific to least:

 1. Project-specific imports: org.mozilla
 2. Third-party libraries: com, net, org
 3. System libraries: android
 4. Language features: java

I have an opinion on the order of the imports (most-to-least or least-to-most), but I think any standard is better than none. On m.d.p.m., kats concurred that the most-to-least order was reasonable and no one voiced any other opinions or opposition.
Attachment #647681 - Flags: review?(mark.finkle)
Attachment #647681 - Flags: review?(mark.finkle) → review+
(Assignee)

Comment 9

5 years ago
Landed patch 3/3:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d14731ba12c1
status-firefox17: affected → fixed
Whiteboard: [leave open]
https://hg.mozilla.org/mozilla-central/rev/d14731ba12c1
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.