78 points · by gfx · 9y ago · 61 comments
> The runtime includes GPL classes which will force your application to GPL. Despite the Apache 2 license the project reports, do not use this unless you understand what adding GPL code to your application means. You are not subject to the classpath exemption when the code is bundled in your app.
https://www.reddit.com/r/androiddev/comments/69rvf4/retropil...
If I take OpenJDK JRE, fork it, make Retropiler out of it and publish it under "GPL plus classpath exception" and then package my Java app together with Retropiler then GPL code is bundled in my app - it is the same as above. Why I am not subject to the classpath exception in this case?
1) OpenJDK allows you to fork under a) GPLv2 or b) GPLv2 + Classpath Exception (see http://openjdk.java.net/legal/gplv2+ce.html, "If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version." where library=OpenJDK and exception=Classpath Exception).
2) Android's OpenJDK fork is licensed under GPLv2 + Classpath Exception (see https://android.googlesource.com/platform/libcore/+/master/L...)
3) Retropiler OpenJDK runtime is licensed under GPL only (see https://github.com/retropiler/retropiler, "The Java classes in runtime/ module which were copied from AOSP are licensed as GPL.")
They could fork OpenJDK and license it with classpath exception which would allow you to (statically or dynamically) bundle your app with OpenJDK under any license. But since they didn't include the classpath exception your app bundling parts of the Retropiler's OpenJDK fork must be under GPL! So you can use it only for open source projects...
Just a guess, though. IANAL and all of that.
There seems to be a Java 9 OpenJDK Android port here: http://openjdk.java.net/projects/mobile/android.html
But hey, lets fork Java and do no evil.
[1] - https://en.wikipedia.org/wiki/List_of_Java_virtual_machines
In any case, I hardly think prolonged failed business negotiations constitute failing to "do no evil".
1: http://www.pcworld.com/article/253666/a_timeline_of_oracles_...
I advise anyone that actually cares about Java™, to spend some time reading AOSP commits regarding OpenJDK integration.
Before Android N they used to come from Apache Harmony and occasionally classes were borrowed from OpenJDK. But thats no longer the case since Android N.
Many methods don't have a full implementation, some classes have partial implementation and not every library class from OpenJDK is taken into Android.
"The successor of Dalvik is Android Runtime (ART), which uses the same bytecode and .dex files (but not .odex files), with the succession aiming at performance improvements transparent to the end users. The new runtime environment was included for the first time in Android 4.4 "KitKat" as a technology preview,[4][5] and replaced Dalvik entirely in later versions; Android 5.0 "Lollipop" is the first version in which ART is the only included runtime."
Bytecode is the thing the Java compiler produces (class files) from your Java source code.
Android N only switched to the Java API (base classes) of OpenJDK. As far as I know they didn't switch runtime environment.
(I know dalvik technically doesn't run bytecode but some other form of intermediary code optimized for mobile devices. I sidestepped that to keep things simple)
Edit: technically dalvik and ART actually execute code from .odex and .oat files
https://android-developers.googleblog.com/2017/03/future-of-...
you can use Lambda expressions and Method References with any Android version... but without Java 8 libraries...
They are supporting Java 8 language features depending on the Android platform version.
Some Java 8 library APIs have been adopted, but require the latest Android versions.
Finally, the JVM bytecodes like invoke dynamic and method handles aren't supported thus making libraries that use them, unusable on Android devices.