Closed
Bug 875088
Opened 12 years ago
Closed 12 years ago
HealthReportGenerator.java fails to compile with JDK 1.7: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
Categories
(Firefox Health Report Graveyard :: Client: Android, defect)
Tracking
(firefox23 fixed, firefox24 fixed)
RESOLVED
FIXED
Firefox 24
People
(Reporter: cpeterson, Assigned: rnewman)
References
Details
Attachments
(1 file)
(deleted),
patch
|
cpeterson
:
review+
lsblakk
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
These methods are annotated with @SuppressWarnings("unchecked"), but JDK 1.7 apparently has a compiler bug that ignores unchecked warning suppressions:
http://stackoverflow.com/questions/13829753/java-generics-suppresswarningsunchecked-mystery
These unchecked warnings can be fixed by (safely) upcasting the JSONObject `document` to a HashMap<String,String> reference and then calling put() on a parameterized HashMap. Something like:
JSONObject jsonDocument = new JSONObject();
HashMap<String,String> document = jsonDocument;
...
document.put("thisPingDate", HealthReportUtils.getDateString(now()));
...
return jsonDocument;
Here is the list of warnings (treated as errors):
JAR gecko-browser.jar
/Users/cpeterson/Code/mozilla/inbound/mobile/android/base/background/healthreport/HealthReportGenerator.java:66: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
document.put("lastPingDate", HealthReportUtils.getDateString(lastPingTime));
^
where K,V are type-variables:
K extends Object declared in class HashMap
V extends Object declared in class HashMap
/Users/cpeterson/Code/mozilla/inbound/mobile/android/base/background/healthreport/HealthReportGenerator.java:69: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
document.put("thisPingDate", HealthReportUtils.getDateString(now()));
^
where K,V are type-variables:
K extends Object declared in class HashMap
V extends Object declared in class HashMap
/Users/cpeterson/Code/mozilla/inbound/mobile/android/base/background/healthreport/HealthReportGenerator.java:70: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
document.put("version", PAYLOAD_VERSION);
^
where K,V are type-variables:
K extends Object declared in class HashMap
V extends Object declared in class HashMap
/Users/cpeterson/Code/mozilla/inbound/mobile/android/base/background/healthreport/HealthReportGenerator.java:72: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
document.put("environments", getEnvironmentsJSON(currentEnvironment, envs));
^
where K,V are type-variables:
K extends Object declared in class HashMap
V extends Object declared in class HashMap
/Users/cpeterson/Code/mozilla/inbound/mobile/android/base/background/healthreport/HealthReportGenerator.java:73: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
document.put("data", getDataJSON(currentEnvironment, envs, since));
^
where K,V are type-variables:
K extends Object declared in class HashMap
V extends Object declared in class HashMap
error: warnings found and -Werror specified
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
5 warnings
Assignee | ||
Comment 1•12 years ago
|
||
Reporter | ||
Comment 2•12 years ago
|
||
Comment on attachment 753055 [details] [diff] [review]
Proposed patch. v1
Review of attachment 753055 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM!
Attachment #753055 -
Flags: review?(cpeterson) → review+
Assignee | ||
Comment 3•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/90c53f21e0d1
Clearing status-firefox23, because when Bug 858742 gets uplifted, it'll be wrong unless this goes with it :D
status-firefox23:
unaffected → ---
Target Milestone: --- → Firefox 24
Comment 4•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Updated•12 years ago
|
Assignee | ||
Comment 5•11 years ago
|
||
Comment on attachment 753055 [details] [diff] [review]
Proposed patch. v1
[Approval Request Comment]
Bug caused by (feature/regressing bug #):
Earlier FHR patch.
User impact if declined:
None, but builds will fail on JDK7.
Testing completed (on m-c, etc.):
Landed ages ago.
Risk to taking this patch (and alternatives if risky):
None.
String or IDL/UUID changes made by this patch:
None.
Attachment #753055 -
Flags: approval-mozilla-aurora?
Comment 6•11 years ago
|
||
Comment on attachment 753055 [details] [diff] [review]
Proposed patch. v1
Approving for uplift as part of the body of work for FHR's first revision on Android.
Attachment #753055 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee | ||
Comment 7•11 years ago
|
||
Updated•11 years ago
|
status-firefox23:
--- → fixed
Updated•6 years ago
|
Product: Firefox Health Report → Firefox Health Report Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•