[reflect] Fix flaky tests that depend on Reflection.clearCaches()
* Use ReflectionFactoryImpl as single point of synchronization * Synchronize all cache-sensitive tests on it in order to be robust in parallel test runners * Remove redundant cache clear after each test Merge-request: KT-MR-6842 Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
This commit is contained in:
committed by
Space
parent
94abeb64c5
commit
e32e5c26a4
+3
-1
@@ -12,7 +12,9 @@ inline fun check(message: String, generate: () -> Any?) {
|
||||
x1 = generate()
|
||||
|
||||
// Force clear the internal maps, as if the weak values in them are garbage-collected.
|
||||
kotlin.reflect.jvm.internal.ReflectionFactoryImpl.clearCaches()
|
||||
synchronized(kotlin.reflect.jvm.internal.ReflectionFactoryImpl::class.java) {
|
||||
kotlin.reflect.jvm.internal.ReflectionFactoryImpl.clearCaches()
|
||||
}
|
||||
|
||||
x2 = generate()
|
||||
} catch (e: Throwable) {
|
||||
|
||||
Vendored
+3
-1
@@ -11,7 +11,9 @@ inline fun check(message: String, generate: () -> Any?) {
|
||||
x1 = generate()
|
||||
|
||||
// Force clear the internal maps, as if the weak values in them are garbage-collected.
|
||||
kotlin.reflect.jvm.internal.ReflectionFactoryImpl.clearCaches()
|
||||
synchronized(kotlin.reflect.jvm.internal.ReflectionFactoryImpl::class.java) {
|
||||
kotlin.reflect.jvm.internal.ReflectionFactoryImpl.clearCaches()
|
||||
}
|
||||
|
||||
x2 = generate()
|
||||
} catch (e: Throwable) {
|
||||
|
||||
Reference in New Issue
Block a user