New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 728443 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocked on:
issue 730711
issue 756176



Sign in to add a comment

Support Java 8 default and static interface methods

Project Member Reported by aelias@chromium.org, Jun 1 2017

Issue description

For our refactoring plan https://docs.google.com/document/d/15EwQXNuO_P0aojTNmT44c4O-ssaFHydJLBqKNLMU-9o/edit, we're interested in using Java 8 default and static methods.  An example is WebContents.java of which a large number of methods which can have empty implementations, and it also needs a factory method to create WebContentsImpl.

Looks like this is an optional feature of retrolambda and https://github.com/orfjackal/retrolambda#known-limitations says: "Backporting default methods and static methods on interfaces requires all backported interfaces and all classes which implement them or call their static methods to be backported together, with one execution of Retrolambda. In other words, you must always do a clean build. Also, backporting default methods won't work across module or dependency boundaries."

I'm not sure how much of a problem this is in practice given our build. 
 If not viable, we can make do with abstract classes or separate Factory classes instead, but I wanted to file the feature request to know what we should go with.
 
Cc: jinsuk...@chromium.org

Comment 2 by zpeng@chromium.org, Jun 5 2017

Status: WontFix (was: Available)
Unfortunately, after deliberation, in the near future we're not able to support Java 8 default and static interface methods for two reasons:
1. Enabling Java 8 incurs an overhead in code size and method counts. Currently we're not sure that the benefits outweigh the overhead and are waiting for the results of proguard obfuscation (crbug.com/620323).
2. Running retrolambda only once would break incremental build.

BTW supporting Java 8 default and static interface methods with Desugar, the internal Java backporting tool, is still WIP.

Comment 3 by zpeng@chromium.org, Jun 7 2017

Blockedon: -642600 730711
Owner: zpeng@chromium.org
Status: Available (was: WontFix)
Update:

After contacting our javac team, we have learned that it is possible for Desugar to support Java 8 default and static interface methods, without breaking our build.

We'll try supporting Java 8 with Desugar. Unfortunately, we don't have an ETA.

(created  crbug.com/730711  for tracking)

Comment 4 by zpeng@chromium.org, Jul 19 2017

Update:

We're making lots of progress with Java 8 support with Desugar. We cannot make a promise, but I believe default and static interface methods support is on the horizon :)

Comment 5 by aelias@chromium.org, Jul 19 2017

Great, thanks for the update.

Comment 6 by zpeng@chromium.org, Aug 9 2017

Status: Fixed (was: Available)
Support for Java 8 default and static interface methods is live :)


Comment 7 by boliu@chromium.org, Aug 9 2017

planning on announcing this more widely?

Comment 8 by zpeng@chromium.org, Aug 9 2017

Yes, but we're waiting for possible breakages. The change for Java 8 was in yesterday, and the first batch of conversions from anonymous classes to lambdas was in early this morning. If nothing bad happens, we'll email clank team and maybe external chromium-dev (and also keep converting anonymous classes to lambdas)

Comment 9 by zpeng@chromium.org, Aug 16 2017

Blockedon: 756176
Project Member

Comment 10 by bugdroid1@chromium.org, Aug 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c96c282264cc9cd6cf16ed60895d8b148ef011f0

commit c96c282264cc9cd6cf16ed60895d8b148ef011f0
Author: Felix <zpeng@chromium.org>
Date: Mon Aug 21 17:20:54 2017

Fix javac:interface_classpath in build_config

This CL fixes javac:interface_classpath so that it does not create
non-existent entries for jar files in deps_info:extra_classpath_jars.

This change also enables Desugar to use javac:interface_classpath
instead of deps_info:java:full_classpath

Bug:  728443 ,  756176 
Change-Id: I579c09ef846f914cbcff3dcaf392e418983dc562
Reviewed-on: https://chromium-review.googlesource.com/621808
Commit-Queue: Felix <zpeng@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495970}
[modify] https://crrev.com/c96c282264cc9cd6cf16ed60895d8b148ef011f0/build/android/gyp/write_build_config.py
[modify] https://crrev.com/c96c282264cc9cd6cf16ed60895d8b148ef011f0/build/config/android/internal_rules.gni

Sign in to add a comment