Closed
Bug 1305461
Opened 8 years ago
Closed 8 years ago
Add generic keep annotation to disable ProGuard optimization on fields
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox52 fixed)
RESOLVED
FIXED
Firefox 52
Tracking | Status | |
---|---|---|
firefox52 | --- | fixed |
People
(Reporter: esawin, Assigned: esawin)
Details
Attachments
(2 files, 2 obsolete files)
3.90 KB,
patch
|
sebastian
:
review+
|
Details | Diff | Splinter Review |
964 bytes,
patch
|
sebastian
:
review+
|
Details | Diff | Splinter Review |
We want to have a more generic "keep this" annotation to prevent ProGuard from optimizing fields out which are required, e.g., for lifecycle management of native objects. See https://bugzilla.mozilla.org/show_bug.cgi?id=1302189#c18.
Assignee | ||
Comment 1•8 years ago
|
||
Adds generic @Keep annotation to prevent removal of required fields for native lifecycle management. We could make the annotation name more verbose, but @Keep seemed expressive enough and in-line with the ProGuard language to me. Any better ideas, mcomella or snorp?
Attachment #8794926 -
Flags: review?(michael.l.comella)
Attachment #8794926 -
Flags: feedback?(snorp)
Assignee | ||
Comment 2•8 years ago
|
||
Rename the field annotation for the native reference.
Attachment #8794927 -
Flags: review?(michael.l.comella)
Comment on attachment 8794926 [details] [diff] [review] 0001-Bug-1305461-1.1-Add-Keep-annotation-to-prevent-ProGu.patch Review of attachment 8794926 [details] [diff] [review]: ----------------------------------------------------------------- I like it
Attachment #8794926 -
Flags: feedback?(snorp) → feedback+
Comment 4•8 years ago
|
||
There's a @Keep annotation in the list of support annotations: https://developer.android.com/reference/android/support/annotation/Keep.html Maybe we can use that?
Assignee | ||
Comment 5•8 years ago
|
||
(In reply to Sebastian Kaspari (:sebastian) from comment #4) > There's a @Keep annotation in the list of support annotations: > https://developer.android.com/reference/android/support/annotation/Keep.html > > Maybe we can use that? Looks like we can avoid adding the new interface with this, I can update the patch to use that instead. We'll still need the ProGuard config update.
Assignee | ||
Comment 6•8 years ago
|
||
Comment on attachment 8794926 [details] [diff] [review] 0001-Bug-1305461-1.1-Add-Keep-annotation-to-prevent-ProGu.patch Apparently, we don't have android.* in mozglue.
Attachment #8794926 -
Flags: review?(michael.l.comella) → review?(s.kaspari)
Assignee | ||
Updated•8 years ago
|
Attachment #8794927 -
Flags: review?(michael.l.comella) → review?(s.kaspari)
Comment 7•8 years ago
|
||
I've been talking to nalexander on IRC and there might be an easy way to use the support annotations. We'd need to do two things: 1) Add the support annotations JAR to mozglue * Like we added the JAR here [1], we need to add it here [2] too. 2) Add the proguard configuration from the Android SDK (It includes the rules for @Keep) * Copy the current version from SDK/tools/proguard/proguard-android.txt to mobile/android/config/proguard/ * Add an include line to our proguard config in [3] Do you want to try that? [1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/moz.build#38 [2] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/moz.build#106 [3] https://dxr.mozilla.org/mozilla-central/source/mobile/android/config/proguard/proguard.cfg#269
Updated•8 years ago
|
Attachment #8794927 -
Flags: review?(s.kaspari)
Comment 8•8 years ago
|
||
Comment on attachment 8794926 [details] [diff] [review] 0001-Bug-1305461-1.1-Add-Keep-annotation-to-prevent-ProGu.patch I'll clear the review. Just reflag me when needed :)
Attachment #8794926 -
Flags: review?(s.kaspari)
Assignee | ||
Comment 9•8 years ago
|
||
Attachment #8794926 -
Attachment is obsolete: true
Attachment #8796533 -
Flags: review?(s.kaspari)
Assignee | ||
Comment 10•8 years ago
|
||
Attachment #8794927 -
Attachment is obsolete: true
Attachment #8796535 -
Flags: review?(s.kaspari)
Comment 11•8 years ago
|
||
Comment on attachment 8796533 [details] [diff] [review] 0001-Bug-1305461-1.2-Add-Android-support-annotation-JAR-t.patch Review of attachment 8796533 [details] [diff] [review]: ----------------------------------------------------------------- Awesome :)
Attachment #8796533 -
Flags: review?(s.kaspari) → review+
Updated•8 years ago
|
Attachment #8796535 -
Flags: review?(s.kaspari) → review+
Comment 12•8 years ago
|
||
Pushed by esawin@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/a35bade49303 [1.2] Add Android support annotation JAR to mozglue and import Android ProGuard config for extended annotation support. r=sebastian https://hg.mozilla.org/integration/mozilla-inbound/rev/5af529f03228 [2.2] Replace @JNITarget annotation with @Keep for native reference field. r=sebastian
Comment 13•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a35bade49303 https://hg.mozilla.org/mozilla-central/rev/5af529f03228
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox52:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
Updated•3 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
•