Fix incorrect ProGuard rules that allowed shrinking volatile felds (#2453)
* Fix incorrect ProGuard rules that allowed shrinking volatile felds
Fixes #1564
* Modify ProGuard rules to only affect `kotlinx.coroutines.**`
Before, some rules were applied to a wide range of libraries for no good reason.
Now, they are limited to this library.
diff --git a/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro b/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro
index 60c8d61..1a9ae1c 100644
--- a/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro
+++ b/kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro
@@ -3,12 +3,12 @@
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}
# Most of volatile fields are updated with AFU and should not be mangled
--keepclassmembernames class kotlinx.** {
+-keepclassmembers class kotlinx.coroutines.** {
volatile <fields>;
}
# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater
--keepclassmembernames class kotlin.coroutines.SafeContinuation {
+-keepclassmembers class kotlin.coroutines.SafeContinuation {
volatile <fields>;
}
diff --git a/kotlinx-coroutines-test/resources/META-INF/proguard/coroutines.pro b/kotlinx-coroutines-test/resources/META-INF/proguard/coroutines.pro
index 41c9eb0..1fdfb78 100644
--- a/kotlinx-coroutines-test/resources/META-INF/proguard/coroutines.pro
+++ b/kotlinx-coroutines-test/resources/META-INF/proguard/coroutines.pro
@@ -4,6 +4,6 @@
-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {}
# Most of volatile fields are updated with AFU and should not be mangled
--keepclassmembernames class kotlinx.** {
+-keepclassmembers class kotlinx.coroutines.** {
volatile <fields>;
}