r/androiddev • u/sindisil • Feb 08 '16
"Java 8 will be introduced to Android by changing to OpenJDK"
https://jaxenter.com/java-8-will-be-introduced-to-android-by-changing-to-openjdk-123810.html2
u/s73v3r Feb 08 '16
While it would be nice, I wouldn't hold my breath. They only brought in version 7 of OpenJDK.
3
u/the_hoser Feb 08 '16
Baby steps. Switching from Harmony to OpenJDK is a big step. Using OpenJDK 7 means that, in theory, they're using a compatible platform. Once that integration is complete, they can start working on updating to the OpenJDK 8 codebase.
What makes me curious is whether or not this means they'll be able to translate invokedynamic instructions to run on ART. If so, this opens up all kinds of opportunities.
2
u/badlogicgames Feb 08 '16
The class library has nothing to do with ART being able to do invoke dynamic.
1
u/the_hoser Feb 08 '16
Absolutely. However, the big Java 8 feature makes heavy use of the instruction. If a move to OpenJDK 8 were in the cards, then supporting language features from Java 8 seems natural.
There's no reason lambdas couldn't be implemented in ART without supporting translation of the invokedynamic bytecode. They would "simply" need to implement their own Java compiler.
2
u/badlogicgames Feb 08 '16
And that appears to be essentially what they are doing. If all they want to support is the SAM style invoke dynamic thingy, they can do it ahead-of-time just fine, just by post-processing bytecode/dex.
1
u/the_hoser Feb 08 '16
From what I recall, the main reason they never implemented it for Dalvik was that they didn't find a way to do it without serious performance penalties, and that they did not really consider it to be a target of value ( The Java 7 language never used it, after all ).
Now that ART is the standard target for Android going forward, the fact that it can't be implemented efficiently for Dalvik appears to be a moot point, since the dex bytecode just gets AOT compiled, anyway.
So... yes :)
1
u/s73v3r Feb 08 '16
I'm not saying it can't happen; I hope it does. But given the reaction back at the Android Dev Summit whenever anyone asked about newer Java versions, it didn't sound like they wanted to do it.
1
u/jamespullar Feb 08 '16
I wonder if they are instead holding out to announce Kotlin. It's in beta for 1.0 right now. Kotlin has all the things that people want from Java 8, plus it has good Android Studio integration seeing as it's made by JetBrains.
1
u/FuZzyPImp Feb 09 '16
Kotlin was brought up at the Android Dev Summit. The outcome was basically that you can use Kotlin already if you want to. But providing official support for Java and Kotlin is a big commitment.
1
u/b1ackcat Developer - Checkbook Plus Feb 09 '16
As much as I would love Java 8 features to be a part of Android (especially with how many functional interfaces we deal with), won't there still be the issue of old Android versions running on older devices that won't get updated? So the options will be target API 24+, or stick to the Java 6 way of doing things?
Or am I misunderstanding how things are implemented? Would the java 8 code we write just be compiled down to bytecode and packaged into the APK and be able to utilize the existing instruction set out in the wild?
21
u/QuestionsEverythang Feb 08 '16
Click bait article. Christian Meder is not on the Android team, or at Google at all. His word is his own opinion of what might happen, but he does not speak for anything official on Android.