Cleanup (warnings; formatting)

GitOrigin-RevId: 3016022feb0214c0a3f7d7acddbf5e301894a5cf
This commit is contained in:
Roman Shevchenko
2022-05-23 22:30:19 +02:00
committed by intellij-monorepo-bot
parent a98d6d8814
commit 2fe9ff9524
9 changed files with 38 additions and 39 deletions

View File

@@ -205,7 +205,7 @@ final class UpdateCheckerService {
}
}
if (lastShownFor == 0) {
// ensures that the "what's new" page is shown _only_ for users who have updated from a previous version
// this ensures that the "what's new" page is shown _only_ for users who have updated from a previous version
// (to detect updates, the method relies on imported settings; users starting from scratch are out of luck)
settings.setWhatsNewShownFor(current.getBaselineVersion());
return false;

View File

@@ -5,7 +5,6 @@ import com.intellij.openapi.components.BaseState
import com.intellij.openapi.components.ReportValue
import com.intellij.util.xmlb.annotations.CollectionBean
import com.intellij.util.xmlb.annotations.OptionTag
import java.util.concurrent.TimeUnit
class UpdateOptions : BaseState() {
@get:CollectionBean

View File

@@ -47,20 +47,20 @@ public class UpdateSettings implements PersistentStateComponent<UpdateOptions> {
return myState.isCheckNeeded();
}
public boolean isPluginsCheckNeeded() {
return myState.isPluginsCheckNeeded();
}
public void setCheckNeeded(boolean value) {
myState.setCheckNeeded(value);
}
public boolean isShowWhatsNewEditor() {
return myState.isShowWhatsNewEditor();
public boolean isPluginsCheckNeeded() {
return myState.isPluginsCheckNeeded();
}
public void setShowWhatsNewEditor(boolean value) {
myState.setShowWhatsNewEditor(value);
public void setPluginsCheckNeeded(boolean value) {
myState.setPluginsCheckNeeded(value);
}
public boolean isShowWhatsNewEditor() {
return myState.isShowWhatsNewEditor();
}
public int getWhatsNewShownFor() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.updateSettings.impl
import com.intellij.icons.AllIcons
@@ -62,7 +62,7 @@ class UpdateSettingsConfigurable @JvmOverloads constructor (private val checkNow
.gap(RightGap.SMALL)
comboBox(channelModel)
.bindItem(getter = { settings.selectedActiveChannel },
setter = { settings.selectedChannelStatus = selectedChannel(it) })
setter = { settings.selectedChannelStatus = selectedChannel(it) })
.enabledIf(checkBox.selected)
}
}
@@ -79,8 +79,8 @@ class UpdateSettingsConfigurable @JvmOverloads constructor (private val checkNow
val project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myLastCheckedLabel))
val settingsCopy = UpdateSettings()
settingsCopy.state.copyFrom(settings.state)
settingsCopy.state.isCheckNeeded = true
settingsCopy.state.isPluginsCheckNeeded = true
settingsCopy.isCheckNeeded = true
settingsCopy.isPluginsCheckNeeded = true
if (channelSelectionLockedMessage == null) {
settingsCopy.selectedChannelStatus = selectedChannel(channelModel.selected)
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2019 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmName("UpdateSettingsProviderHelper")
package com.intellij.openapi.updateSettings.impl
@@ -6,7 +6,7 @@ import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.diagnostic.runAndLogException
import com.intellij.openapi.extensions.ExtensionPointName
private val LOG = logger<UpdateOptions>()
private val LOG = logger<UpdateSettingsProvider>()
private val UPDATE_SETTINGS_PROVIDER_EP = ExtensionPointName<UpdateSettingsProvider>("com.intellij.updateSettingsProvider")
interface UpdateSettingsProvider {
@@ -19,4 +19,4 @@ internal fun addPluginRepositories(to: MutableList<String>) {
to.addAll(provider.getPluginRepositories())
}
}
}
}

View File

@@ -1,8 +1,9 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.updateSettings
import com.intellij.configurationStore.deserialize
import com.intellij.openapi.updateSettings.impl.UpdateOptions
import com.intellij.openapi.updateSettings.impl.UpdateSettings
import com.intellij.openapi.util.JDOMUtil
import com.intellij.testFramework.assertions.Assertions.assertThat
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
@@ -11,7 +12,7 @@ import org.junit.Test
class UpdateOptionsTest : BareTestFixtureTestCase() {
@Test fun `auto check is enabled`() {
// it is an important default value (true), so ensure that it is not inadvertently modified
assertThat(UpdateOptions().isCheckNeeded).isTrue
assertThat(UpdateSettings().isCheckNeeded).isTrue
}
@Test fun deserialization() {

View File

@@ -1,36 +1,35 @@
// Copyright 2000-2021 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-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.components;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Every component which would like to persist its state across IDE restarts
* should implement this interface.
* Every component which would like to persist its state across IDE restarts should implement this interface.
* <p>
* See <a href="http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_state_of_components.html">IntelliJ Platform SDK DevGuide</a>
* for detailed description.
* <p>
* Do NOT use for sensitive data, see <a href="http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_sensitive_data.html">Persisting Sensitive Data</a>.
* <strong>DO NOT</strong> use for sensitive data
* (see <a href="http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_sensitive_data.html">Persisting Sensitive Data</a>).
* <p>
* In general, implementation should be thread-safe, because "loadState" is called from the same thread where component is initialized.
* If component used only from one thread (e.g. EDT), thread-safe implementation is not required.
* In general, an implementation should be thread-safe, because "loadState" is called from the same thread where component is initialized.
* If a component is used only from one thread (e.g. EDT), thread-safe implementation is not required.
*
* @see SimplePersistentStateComponent
*/
public interface PersistentStateComponent<T> {
/**
* @return a component state. All properties, public and annotated fields are serialized. Only values, which differ
* from the default (i.e., the value of newly instantiated class) are serialized. {@code null} value indicates
* that the returned state won't be stored, as a result previously stored state will be used.
* @return a component state. All properties, public and annotated fields are serialized.
* Only values which differ from the default (i.e. the value of newly instantiated class) are serialized.
* {@code null} value indicates that the returned state won't be stored, as a result previously stored state will be used.
* @see com.intellij.util.xmlb.XmlSerializer
*/
@Nullable
T getState();
@Nullable T getState();
/**
* This method is called when new component state is loaded. The method can and will be called several times, if
* config files were externally changed while IDE was running.
* This method is called when a new component state is loaded.
* The method can and will be called several times if config files are externally changed while the IDE is running.
* <p>
* State object should be used directly, defensive copying is not required.
*
@@ -42,13 +41,11 @@ public interface PersistentStateComponent<T> {
/**
* This method is called when the component is initialized, but no state is persisted.
*/
default void noStateLoaded() {
}
default void noStateLoaded() { }
/**
* If class also is a service, then this method will be called after loading state (even if no state)
* but only once throughout the life cycle.
*/
default void initializeComponent() {
}
default void initializeComponent() { }
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.editor;
@@ -8,6 +8,7 @@ import com.intellij.openapi.components.SettingsCategory;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@State(
@@ -54,7 +55,7 @@ public class KotlinEditorOptions implements PersistentStateComponent<KotlinEdito
}
@Override
public void loadState(KotlinEditorOptions state) {
public void loadState(@NotNull KotlinEditorOptions state) {
XmlSerializerUtil.copyBean(state, this);
}

View File

@@ -4,6 +4,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -33,7 +34,7 @@ public class LombokSettings implements PersistentStateComponent<LombokPluginStat
}
@Override
public void loadState(LombokPluginState element) {
public void loadState(@NotNull LombokPluginState element) {
myState = element;
}