[kotlin.reflect] Introduce ClassValue-based cache for KClassImpl

* Replace pcollections with ClassValue/ConcurrentHashMap-based caches
* Do not store weak references, instead cache strong references and count on ClassValue to unload the corresponding classloader if necessary
* ConcurrentHashMap does not rely on WeakReference as it's only selected on Android where classloader leaks don't exist
* Update reflect/scripting JDK requirement to Java 8 in order to proceed

#KT-53454
#KT-50705


Merge-request: KT-MR-6788
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
This commit is contained in:
Vsevolod Tolstopyatov
2022-08-05 15:35:34 +00:00
committed by Space
parent d5164fbc86
commit 14b13a2f17
37 changed files with 110 additions and 1129 deletions
@@ -18,4 +18,7 @@
-dontnote kotlin.internal.PlatformImplementationsKt
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
-dontwarn kotlin.reflect.jvm.internal.**
-dontwarn kotlin.reflect.jvm.internal.**
# Statically guarded by try-catch block and not used on Android, see CacheByClass
-dontwarn java.lang.ClassValue
@@ -13,4 +13,12 @@
-dontnote kotlin.internal.PlatformImplementationsKt
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
-dontwarn kotlin.reflect.jvm.internal.**
-dontwarn kotlin.reflect.jvm.internal.**
# Statically guarded by try-catch block and not used on Android, see CacheByClass
-dontwarn java.lang.ClassValue
# Do not even execute try-catch block for ClassValue
-assumenosideeffects class kotlin.reflect.jvm.internal.CacheByClassKt {
boolean useClassValue return false;
}
@@ -20,4 +20,7 @@
-dontnote kotlin.internal.PlatformImplementationsKt
# Don't note on internal APIs, as there is some class relocating that shrinkers may unnecessarily find suspicious.
-dontwarn kotlin.reflect.jvm.internal.**
-dontwarn kotlin.reflect.jvm.internal.**
# Statically guarded by try-catch block and not used on Android, see CacheByClass
-dontwarn java.lang.ClassValue