Closed Bug 1485439 Opened Last year Closed Last year

Enable Java 8 support

Categories

(Firefox Build System :: Android Studio and Gradle Integration, enhancement)

All
Android
enhancement
Not set

Tracking

(firefox64 fixed)

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: JanH, Assigned: JanH)

References

Details

Attachments

(1 file)

Did we ever consider enabling Java 8 support, or is there any particular reason why we wouldn't want to do this?

Doing this would enable using try-with-resources on all API levels still supported by Firefox, which e.g. allows for a nicer way of locally whitelisting certain StrictMode violations.
(In reply to Jan Henning [:JanH] from comment #0)
> Did we ever consider enabling Java 8 support, or is there any particular
> reason why we wouldn't want to do this?

It was my understanding that we couldn't without targeting an API level higher than we do -- 19 or 21, IIRC.  In the past there were also issues with bytecode and tooling, but I think those are all solved.  If we can, we should, 'cuz Java 1.7 is pretty ancient now.
(In reply to Nick Alexander :nalexander [he/him] from comment #1)
> (In reply to Jan Henning [:JanH] from comment #0)
> > Did we ever consider enabling Java 8 support, or is there any particular
> > reason why we wouldn't want to do this?
> 
> It was my understanding that we couldn't without targeting an API level
> higher than we do -- 19 or 21, IIRC.

According to https://developer.android.com/studio/write/java8-support, some features are only supported only on API24, or in one case even API26, but everything else now works on any Android version when using a new enough Android plugin to build (not sure if literally *any* version, but certainly any version we still care about, i.e. API16 and up).
Assignee: nobody → jh+bugzilla
Doing so allow to use try-with-resources on all API levels supported by us, not
just starting from API19.

Unfortunately this step also introduces some additional ambiguities in overload
resolution, which means that one of GeckoResult's "then" overloads needs to be
renamed.

We also take the opportunity to update to the current version of the Android
Gradle plugin.
Comment on attachment 9006084 [details]
Bug 1485439 - Upgrade to Java 8. r?nalexander,jchen

Nick Alexander :nalexander [he/him] has approved the revision.
Attachment #9006084 - Flags: review+
Comment on attachment 9006084 [details]
Bug 1485439 - Upgrade to Java 8. r?nalexander,jchen

Jim Chen [:jchen] [:darchons] has approved the revision.
Attachment #9006084 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/e3e41bd5523e
https://hg.mozilla.org/mozilla-central/rev/d81912697dac
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
It seems one side effect of this change is it requires any other project that depends on GeckoView to upgrade their target compatibility to 1.8, otherwise the build can fail with rather cryptic errors. For example, I had to manually update my local build of Focus. This is not necessarily bad, but maybe we should send out a message to relevant mailing lists as an announcement.
(In reply to Jim Chen [:jchen] [:darchons] from comment #8)
> It seems one side effect of this change is it requires any other project
> that depends on GeckoView to upgrade their target compatibility to 1.8,
> otherwise the build can fail with rather cryptic errors. For example, I had
> to manually update my local build of Focus. This is not necessarily bad, but
> maybe we should send out a message to relevant mailing lists as an
> announcement.

Done: https://mail.mozilla.org/pipermail/mobile-firefox-dev/2018-September/002411.html.
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 64 → mozilla64
You need to log in before you can comment on or make changes to this bug.