Last Comment Bug 778472 - Clean up Java imports
: Clean up Java imports
Status: RESOLVED FIXED
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: Trunk
: ARM Android
: P4 normal (vote)
: Firefox 17
Assigned To: Chris Peterson [:cpeterson]
:
Mentors:
Depends on:
Blocks: 743998
  Show dependency treegraph
 
Reported: 2012-07-28 12:21 PDT by Chris Peterson [:cpeterson]
Modified: 2012-08-01 19:40 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
wontfix
fixed


Attachments
part-1-remove-unused-imports.patch (16.38 KB, patch)
2012-07-28 12:26 PDT, Chris Peterson [:cpeterson]
mark.finkle: review+
Details | Diff | Review
part-2-replace-wildcard-imports.patch (17.92 KB, patch)
2012-07-28 12:29 PDT, Chris Peterson [:cpeterson]
mark.finkle: review+
Details | Diff | Review
part-3-standardize-import-order.patch (127.98 KB, patch)
2012-07-31 14:23 PDT, Chris Peterson [:cpeterson]
mark.finkle: review+
Details | Diff | Review

Description Chris Peterson [:cpeterson] 2012-07-28 12:21:53 PDT

    
Comment 1 Chris Peterson [:cpeterson] 2012-07-28 12:26:42 PDT
Created attachment 646892 [details] [diff] [review]
part-1-remove-unused-imports.patch

Part 1: Remove unused and redundant import statements.
Comment 2 Chris Peterson [:cpeterson] 2012-07-28 12:29:20 PDT
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
Comment 3 Chris Peterson [:cpeterson] 2012-07-28 12:49:35 PDT
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 4 Mark Finkle (:mfinkle) (use needinfo?) 2012-07-28 21:40:05 PDT
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.
Comment 5 Chris Peterson [:cpeterson] 2012-07-29 00:23:44 PDT
(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/
Comment 8 Chris Peterson [:cpeterson] 2012-07-31 14:23:08 PDT
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.
Comment 9 Chris Peterson [:cpeterson] 2012-08-01 12:57:47 PDT
Landed patch 3/3:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d14731ba12c1
Comment 10 Ryan VanderMeulen [:RyanVM] 2012-08-01 19:40:33 PDT
https://hg.mozilla.org/mozilla-central/rev/d14731ba12c1

Note You need to log in before you can comment on or make changes to this bug.