Closed Bug 1218477 (lint-newapi) Opened 9 years ago Closed 4 years ago

[meta] Fix lint: NewApi issues in app module

Categories

(Firefox for Android Graveyard :: General, defect, P5)

defect

Tracking

(fennec+)

RESOLVED INCOMPLETE
Tracking Status
fennec + ---

People

(Reporter: nalexander, Unassigned)

References

Details

(Keywords: meta)

Right now, mobile/android's Java code base has a huge number of lint warnings due to Android SDK version mismatches. This ticket tracks using standard practices to minimize the warnings, with the belief that we may find some real positives in the warning soup. We have rolled our own AppConstants.Versions flags, which foils the linter. Perhaps there's an equivalent construct that the linter understands? Perhaps we can make our own linter extension to handle our construct?
The simple fix is probably to liberally scatter @TargetApi(21) etc. all over the codebase, wherever an API isn't available in an earlier release.
Also, apparently this was improved recently (July): https://code.google.com/p/android/issues/detail?id=178686 https://android-review.googlesource.com/#/c/157845/ so perhaps we just need a more recent linter.
Worth noting that it is possible to write custom rules: https://github.com/googlesamples/android-custom-lint-rules However, if Richard is correct, this shouldn't be necessary. Unfortunately, I loaded fennec into Android Studio and found the warnings still present – perhaps I need to update my android SDK (updated maybe a week ago?) or these changes haven't been released into the mainline lint yet. NI self to investigate.
Blocks: android-lint
Flags: needinfo?(michael.l.comella)
Summary: Avoid SDK version lint warnings in mobile/android Java code → [lint: TargetApi] Avoid SDK version lint warnings in mobile/android Java code
nalexander mentioned elsewhere that IJ15 gets features from AS1.3 – maybe this just works?
This is not fixed in IJ 15.0.3. Nick, I hear you run AS with fennec – does this just work?
Flags: needinfo?(michael.l.comella) → needinfo?(nalexander)
Summary: [lint: TargetApi] Avoid SDK version lint warnings in mobile/android Java code → [lint: NewApi] Avoid SDK version lint warnings in mobile/android Java code
(In reply to Michael Comella (:mcomella) from comment #5) > This is not fixed in IJ 15.0.3. > > Nick, I hear you run AS with fennec – does this just work? I remember being disappointed that it does not get better. I dug into the lint code and it's looking for a very specific if guard, which we don't meet with our fancy Version constants. I think we should confirm that and then inline all of those tests. Lint is more valuable than an unsubstantiated Proguard win.
Flags: needinfo?(nalexander)
Or write a custom lint rule (comment 3) for our specific checks.
tracking-fennec: --- → +
Priority: -- → P2
Assignee: nobody → osimpleo
Blocks: 1235670
No longer blocks: gradle
Summary: [lint: NewApi] Avoid SDK version lint warnings in mobile/android Java code → [meta] Fix lint: NewApi issues in app module
Status: NEW → ASSIGNED
Depends on: 1365878
Depends on: 1369631
Depends on: 1369633
Depends on: 1369634
Depends on: 1369635
Depends on: 1369636
Depends on: 1369637
Depends on: 1369638
Depends on: 1369639
Depends on: 1369641
Depends on: 1369643
Depends on: 1369645
Depends on: 1369646
Depends on: 1369649
Depends on: 1369648
Depends on: 1369650
Depends on: 1369651
Depends on: 1369652
Depends on: 1369653
Depends on: 1369654
Depends on: 1373143
Need to unassign myself atm since shift to some other works.
Assignee: osimpleo → nobody
Status: ASSIGNED → NEW
Alias: lint-newapi
bug 1369631 is resolved so we can safely remove <ignore path="**/mobile/android/base/java/org/mozilla/gecko/activitystream/ActivityStreamPreference.java"/>
The dependencies here all seem related to Android, and the linting file seems to be related to android, so moving across to there, as it doesn't feel like a general build configuration issue.
Component: Build Config → General
Product: Core → Firefox for Android
Re-triaging per https://bugzilla.mozilla.org/show_bug.cgi?id=1473195 Needinfo :susheel if you think this bug should be re-triaged.
Priority: P2 → P5
Keywords: meta
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.