Merge "Add -Xjvm-defaults=all to kotlin compilations" am: 01365d5890

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2139092

Change-Id: I71d6538976170f0ac5ebf3e520f853a4fefad3f1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Cole Faust 2022-07-08 05:40:19 +00:00 committed by Automerger Merge Worker
commit d5ac017c49

View file

@ -1072,6 +1072,13 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
kotlincFlags := j.properties.Kotlincflags
CheckKotlincFlags(ctx, kotlincFlags)
// This is needed for code that depends on libraries that use @JvmDefault
// -Xjvm-default=all will be the default in a future version of kotlin
// according to https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-m3-generating-default-methods-in-interfaces/
if flags.javaVersion >= JAVA_VERSION_8 {
kotlincFlags = append(kotlincFlags, "-Xjvm-default=all")
}
// Workaround for KT-46512
kotlincFlags = append(kotlincFlags, "-Xsam-conversions=class")