OpenJDK 8 or OpenJDK 9 for AOSP 10: which one?

820 views
Skip to first unread message

John W. Blue

unread,
Oct 24, 2019, 10:40:20 AM10/24/19
to android-...@googlegroups.com

Hello,

 

I read here:

 

https://android.googlesource.com/platform/build/+/refs/tags/android-10.0.0_r6/core/java_common.mk

 

# TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules

    LOCAL_JAVA_LANGUAGE_VERSION := 1.8

  else

# DEFAULT_JAVA_LANGUAGE_VERSION is 1.8, unless TARGET_OPENJDK9 in which case it is 1.9

 

So is OpenJDK 8 the recommended version or is OpenJDK 9?  And is java_common.mk file the only way to tell?

 

John

Colin Cross

unread,
Oct 24, 2019, 6:32:32 PM10/24/19
to android-...@googlegroups.com
The source for Android 10 includes prebuilt java toolchains used for compiling the platform in prebuilts/jdk/jdk8 and prebuilts/jdk/jdk9, so there should be no need to provide any OpenJDK version.

The platform always uses javac from OpenJDK9 to compile (prebuilts/jdk/jdk9/linux-x86/bin/javac), OpenJDK8 is EOL upstream.    Those comments are about selecting what language features are being targeted by the OpenJDK 9 toolchain.  In Android 10, we default to passing -source 1.8 -target 1.8 to javac to target OpenJDK8 language features, unless you set EXPERIMENTAL_USE_OPENJDK9=true on the command line, which will default to passing -source 1.9 -target 1.9.  There is no reason to do this in Android 10, as there is no platform support for Java language 9 features.  In master you can use EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true to get the same effect.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/68b4db88bc69402a9b2a89458fe3258e%40mail.rrcic.com.

Colin Cross

unread,
Oct 25, 2019, 1:25:42 PM10/25/19
to android-...@googlegroups.com
Correction, EXPERIMENTAL_JAVA_LANUAGE_LEVEL_9=true is the default in master, and is moving to required with https://android-review.googlesource.com/c/platform/build/soong/+/1151196.
Reply all
Reply to author
Forward
0 new messages