diff --git a/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java b/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java index 351e3a563a67..f4e0891b0911 100644 --- a/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java +++ b/java/testFramework/src/com/intellij/compiler/CompilerTestUtil.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.compiler; import com.intellij.compiler.server.BuildManager; @@ -21,6 +7,7 @@ import com.intellij.openapi.application.PathMacros; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.ServiceKt; +import com.intellij.openapi.components.impl.stores.IComponentStore; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; @@ -52,21 +39,22 @@ public class CompilerTestUtil { @TestOnly public static void saveApplicationSettings() { + IComponentStore store = getApplicationStore(); EdtTestUtil.runInEdtAndWait(() -> { - doSaveComponent((PersistentStateComponent)ProjectJdkTable.getInstance()); - doSaveComponent((PersistentStateComponent)FileTypeManager.getInstance()); - doSaveComponent((PersistentStateComponent)PathMacros.getInstance()); + store.saveApplicationComponent((PersistentStateComponent)ProjectJdkTable.getInstance()); + store.saveApplicationComponent((PersistentStateComponent)FileTypeManager.getInstance()); + store.saveApplicationComponent((PersistentStateComponent)PathMacros.getInstance()); }); } + @NotNull + private static IComponentStore getApplicationStore() { + return ServiceKt.getStateStore(ApplicationManager.getApplication()); + } + @TestOnly public static void saveApplicationComponent(@NotNull PersistentStateComponent appComponent) { - EdtTestUtil.runInEdtAndWait(() -> doSaveComponent(appComponent)); - } - - private static void doSaveComponent(@NotNull PersistentStateComponent component) { - //noinspection TestOnlyProblems - ServiceKt.getStateStore(ApplicationManager.getApplication()).saveApplicationComponent(component); + EdtTestUtil.runInEdtAndWait(() -> getApplicationStore().saveApplicationComponent(appComponent)); } @TestOnly diff --git a/platform/platform-impl/src/com/intellij/configurationStore/StateStorageBase.kt b/platform/platform-impl/src/com/intellij/configurationStore/StateStorageBase.kt index c2c82d0c306e..816917d95a3b 100644 --- a/platform/platform-impl/src/com/intellij/configurationStore/StateStorageBase.kt +++ b/platform/platform-impl/src/com/intellij/configurationStore/StateStorageBase.kt @@ -12,7 +12,7 @@ import java.util.concurrent.atomic.AtomicReference private val LOG = logger>() abstract class StateStorageBase : StateStorage { - private var mySavingDisabled = false + private var isSavingDisabled = false protected val storageDataRef: AtomicReference = AtomicReference() @@ -55,17 +55,17 @@ abstract class StateStorageBase : StateStorage { fun disableSaving() { LOG.debug { "Disabled saving for ${toString()}" } - mySavingDisabled = true + isSavingDisabled = true } fun enableSaving() { LOG.debug { "Enabled saving ${toString()}" } - mySavingDisabled = false + isSavingDisabled = false } protected fun checkIsSavingDisabled(): Boolean { LOG.debug { "Saving disabled for ${toString()}" } - return mySavingDisabled + return isSavingDisabled } } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java b/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java index 8073f1d9270f..4cb8ac1f9053 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.openapi.components; import org.jdom.Element; @@ -65,6 +51,8 @@ public interface PathMacroSubstitutor { */ void collapsePaths(@NotNull Element element, boolean recursively); + + @Contract("null -> null; !null -> !null") default String collapsePathsRecursively(@Nullable String text) { return collapsePath(text, true);