They forked Java by cherry picking features and APIs, and are making it increasingly difficult to write portable code across standard Java and Android Java.
Any Java library that depends on Java 7 or 8 standard libraries not available on Android, newly introduced JVM bytecodes, some of the Java 8 language features, annotation processors, ... isn't usable on Android.
Good luck getting Java 9 modules, or eventually Java 10 value types and updated generics when they become available.
Google has no interest in providing the right support for Java developers it seems.
Lack of Java 8 bytecode now, then lack of Java 9 modules tomorrow, and eventually lack of Java 10 value types and improved generics, arrays and JNI replacement.
And of course, lack of many of the SE APIs in any case.
The fun of writing portable libraries between Java and Android Java is only getting better.
A subset of Java with partial support for the standard library is the the lingua franca of Android, forcing a fork on the Java community for any library author that wants to target standard Java and Android Java.
By the time Java 10 gets out, they can see how libraries that make use of modules, reified generics, value types, GPGPU integration, JIT plugins are out of reach.
Worse even, having library devs writing two versions of their libraries.
Google's fork of Java is leading to a Python 2 - 3 scenario.
Though I understand their reasoning to a degree, it does seem perverse that they adopted the most pedestrian bit of java -- the language -- while jettisoning the crown jewel -- the JVM.
It hasn't been trivial to get other JVM languages working on Android, and ironically that list now includes Java 8.
Yeah, Android Java has turned into Google's own version of J++.
Worse is that Kotlin fanboys don't get it, that without access to modern Java their Java FFI is worthless, as all Java 8+ libraries on Maven Central will slowly become useless on Android no matter what.
Additionally the language cannot expose JVM capabilities, unless they had even another backend.
So it will be stuff like value types, JNI replacement, proper generics, customized JIT and SIMD on the JVM, and plain old Java 8 on ART.
Java might be source compatible, but sometimes it is quite fun to make libraries work across versions.
Specially if they rely on APIs that did break, like JDBC interfaces.
Also Android Java isn't 100% Java as Google cherry picks APIs, which with the increase of Java 8's adoption is increasing the effort to write portable libraries that compile against Java and Android Java.
Also Android Java runtimes don't understand the bytecodes introduced in Java 7 and 8. So you cannot use libraries that make use of them.
This will only get worse with Java 9 modularity and with the value types, reiffed generics and new FFI planned for Java 10.
The Android tools now have essentially-fake support for Java 7. Basically, they updated dx (the classfile-to-dex converter) to not throw exceptions immediately upon encountering a v51-format (Java 7) classfile, but, rather, to throw exceptions whenever such a file actually contains Java 7-specific bytecode features (MethodHandles, InvokeDynamic, and related features). This means that Android has support for the syntax-only features of Java 7 (the ones implemented entirely upstream in javac), but falls short of implementing any of the actually-interesting platform features that would have required changes to the phone-side VM.
Edit: The reason I bring this up (apart from being a little bit sore about it, personally), is that this means that Android is actually really far from Java 8 support, as these features were added in Java 7 at least partially to facilitate lambda support in Java 8 (see http://cr.openjdk.java.net/~briangoetz/lambda/lambda-transla...).
I don't believe, given what they repeat at every Google IO when people ask about it.
Also I don't have any issue with Java as I do like the language and use it since JDK 1.0.1.
My issue is with Android Java, a forked version of Java with cherry picked features of Java 6, 7 and now 8, just because Google didn't want to pay Sun.
A version that will be even harder to write portable code when Java 9 and 10 come out.
Any Java library that depends on Java 7 or 8 standard libraries not available on Android, newly introduced JVM bytecodes, some of the Java 8 language features, annotation processors, ... isn't usable on Android.
Good luck getting Java 9 modules, or eventually Java 10 value types and updated generics when they become available.
reply