Support Java 8 default and static interface methods |
|||||
Issue descriptionFor 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.
,
Jun 5 2017
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.
,
Jun 7 2017
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)
,
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 :)
,
Jul 19 2017
Great, thanks for the update.
,
Aug 9 2017
Support for Java 8 default and static interface methods is live :)
,
Aug 9 2017
planning on announcing this more widely?
,
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)
,
Aug 16 2017
,
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 |
|||||
Comment 1 by aelias@chromium.org
, Jun 1 2017