mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
clearBindingCache for MPS (hot swap friendly)
This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
package com.intellij.configurationStore.xml
|
||||
|
||||
import com.intellij.configurationStore.StoredPropertyStateTest
|
||||
import com.intellij.configurationStore.clearBindingCache
|
||||
import com.intellij.configurationStore.deserialize
|
||||
import com.intellij.configurationStore.serialize
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.assertConcurrent
|
||||
import com.intellij.testFramework.assertions.Assertions.assertThat
|
||||
import com.intellij.util.loadElement
|
||||
@@ -15,6 +17,7 @@ import com.intellij.util.xmlb.annotations.*
|
||||
import junit.framework.TestCase
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.jdom.Element
|
||||
import org.junit.Assume.assumeTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Suite
|
||||
@@ -52,6 +55,12 @@ internal class XmlSerializerTest {
|
||||
</Bean>""", data)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testClearBindingCache() {
|
||||
assumeTrue(!UsefulTestCase.IS_UNDER_TEAMCITY)
|
||||
clearBindingCache()
|
||||
}
|
||||
|
||||
@Test fun emptyBeanSerialization() {
|
||||
class EmptyBean
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
@file:JvmName("XmlSerializer")
|
||||
package com.intellij.configurationStore
|
||||
|
||||
@@ -179,6 +177,19 @@ private val serializer = object : XmlSerializerImpl.XmlSerializerBase() {
|
||||
binding
|
||||
}
|
||||
}
|
||||
|
||||
fun clearBindingCache() {
|
||||
cacheLock.write {
|
||||
_bindingCache?.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* used by MPS. Do not use if not approved.
|
||||
*/
|
||||
fun clearBindingCache() {
|
||||
serializer.clearBindingCache()
|
||||
}
|
||||
|
||||
private data class BindingCacheKey(val type: Type, val accessor: MutableAccessor?)
|
||||
|
||||
Reference in New Issue
Block a user