From 8d9c8b7eace935ba08f89360f57d590166a09220 Mon Sep 17 00:00:00 2001 From: Olafur Pall Geirsson Date: Tue, 3 Nov 2020 15:10:06 +0100 Subject: [PATCH] Disable inlining of Scala library methods. Previously, the Scala compiler was configured to inline all usages of symbols in under the `scala` package. This is problematic because it means that published Kafka jars must run with the exact same version of the Scala library that the Kafka jar was compiled with. If the runtime uses a different version of the Scala library then users risk getting a crash like this: ``` java.lang.NoClassDefFoundError: scala/math/Ordering$$anon$7 ``` This commit disables inlining from the `scala` package to prevent crashes like this. The downside to this change is it may introduce performance regressions. --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a3690029d96ff..990e9a8161bdc 100644 --- a/build.gradle +++ b/build.gradle @@ -515,7 +515,7 @@ subprojects { // Kafka project in that case. List inlineFrom if (project.name.equals('core')) - inlineFrom = ["-opt-inline-from:scala.**", "-opt-inline-from:kafka.**", "-opt-inline-from:org.apache.kafka.**"] + inlineFrom = ["-opt-inline-from:scala.util.Either.**", "-opt-inline-from:scala.Option.**", "-opt-inline-from:kafka.**", "-opt-inline-from:org.apache.kafka.**"] else inlineFrom = ["-opt-inline-from:org.apache.kafka.**"]