Hacker News new | ask | show | jobs
by pejrich 2851 days ago
If Java is open and free, then why did Android decide to rewrite Java? I notice a lot of companies seem to avoid Java so there must be some sort of a catch.
3 comments

Android is quickly moving away from Java to make Kotlin the default language nowadays, it's probably in part due to the Java lawsuit (and in part to add language features quicker without changing the VM).
They aren't rewriting the Java parts.

Kotlin just gets an additional library to make some SDK usage a bit easier.

No indeed but they are clearly phasing out Java as the default language in the future, I don't see much plan to fully adopt Java 8 (only partial support for now) and Java 9 (no support) for Android. Since they are using their custom ART Runtime, it's not even impossible they would add VM instructions specific to Kotlin in the future (I don't have any knowledge of that yet but that would not surprise me).
That will only happen when Android Frameworks and lower level stack gets rewriten in Kotlin.

No mention of Kotlin in Treble documentation, only Java and C++.

It is like hoping UNIX derivatives will use anything other than C on their kernels.

AOSP commit messages show initial support for Java 9 and their clamp down in reflection for private APIs done in Android P seems to be a step towards Java modules.

I see an easier path just rebooting everything with Fuchsia than having them rewriting Android in Kotlin.

You're a long time out of date at this point. Google merged openjdk a long time ago for their base JVM.

https://www.theregister.co.uk/2015/12/30/android_openjdk/

They didn't fully merged OpenJDK, just selected parts of it, across multiple Android versions.

Compatibility is still kind of broken.

It isn't possible to guarantee that any random Java library is usable on Android.

Yes not all of it - there are still android specific bits yet. Enough of it is openjdk though.
And given how updates work....
Because when Sun was still around that wasn't the case and Google didn't want to pay for licenses.

Here is what Gosling has to say on it.

https://www.youtube.com/watch?v=ZYw3X4RZv6Y&feature=youtu.be...