private getters are not supported by serializer and visible tree state not stored correctly as result

This commit is contained in:
Vladimir Krivosheev
2018-07-19 13:14:05 +02:00
parent f1fb581cc9
commit db6aec8343
2 changed files with 10 additions and 10 deletions
@@ -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.
package com.intellij.codeInspection.ex
import com.intellij.openapi.components.BaseState
@@ -17,10 +15,10 @@ import javax.swing.tree.TreePath
@Tag("profile-state")
internal class VisibleTreeState : BaseState() {
@get:XCollection(elementName = "expanded", valueAttributeName = "path", propertyElementName = "expanded-state")
private var expandedNodes by property(TreeSet<State>())
var expandedNodes by property(TreeSet<State>())
@get:XCollection(elementName = "selected", valueAttributeName = "path", propertyElementName = "selected-state")
private var selectedNodes by property(TreeSet<State>())
var selectedNodes by property(TreeSet<State>())
fun expandNode(node: InspectionConfigTreeNode) {
expandedNodes.add(getState(node))
@@ -99,7 +97,11 @@ internal class VisibleTreeState : BaseState() {
internal class State @JvmOverloads constructor(key: String? = null): Comparable<State>, BaseState() {
@get:Tag("id")
var key by string(key)
var key by string()
init {
this.key = key
}
override fun compareTo(other: State) = StringUtil.compare(key, other.key, false)
}
@@ -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.
package com.intellij.codeInspection.ex
import com.intellij.codeInspection.InspectionProfile
@@ -11,7 +9,7 @@ import com.intellij.util.xmlb.annotations.Property
internal class VisibleTreeStateComponent : BaseState() {
@get:Property(surroundWithTag = false)
@get:MapAnnotation(surroundWithTag = false, surroundKeyWithTag = false, surroundValueWithTag = false)
private var profileNameToState by map<String, VisibleTreeState>()
var profileNameToState by map<String, VisibleTreeState>()
fun getVisibleTreeState(profile: InspectionProfile) = profileNameToState.getOrPut(profile.name) {
incrementModificationCount()