From db6aec8343586ebd6f5dbb019ce264375d36a20d Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 19 Jul 2018 11:14:47 +0200 Subject: [PATCH] private getters are not supported by serializer and visible tree state not stored correctly as result --- .../intellij/codeInspection/ex/VisibleTreeState.kt | 14 ++++++++------ .../codeInspection/ex/VisibleTreeStateComponent.kt | 6 ++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.kt b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.kt index fec51504edbe..cc05e7fd01ee 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.kt +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeState.kt @@ -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()) + var expandedNodes by property(TreeSet()) @get:XCollection(elementName = "selected", valueAttributeName = "path", propertyElementName = "selected-state") - private var selectedNodes by property(TreeSet()) + var selectedNodes by property(TreeSet()) 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, 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) } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeStateComponent.kt b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeStateComponent.kt index 9f4ef08ef748..32f9ec356e00 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeStateComponent.kt +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/VisibleTreeStateComponent.kt @@ -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() + var profileNameToState by map() fun getVisibleTreeState(profile: InspectionProfile) = profileNameToState.getOrPut(profile.name) { incrementModificationCount()