diff --git a/platform/vcs-log/impl/src/META-INF/vcs-log.xml b/platform/vcs-log/impl/src/META-INF/vcs-log.xml index 9625a706631f..446108773eee 100644 --- a/platform/vcs-log/impl/src/META-INF/vcs-log.xml +++ b/platform/vcs-log/impl/src/META-INF/vcs-log.xml @@ -1,5 +1,4 @@ - @@ -18,17 +17,12 @@ displayNameSupplierClassName="com.intellij.vcs.log.impl.VcsLogContentProvider$DisplayNameSupplier"/> - - - - - diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsUserRegistryImpl.kt b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsUserRegistryImpl.kt index 896425e035ef..517816671615 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsUserRegistryImpl.kt +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsUserRegistryImpl.kt @@ -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-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. package com.intellij.vcs.log.data import com.intellij.openapi.Disposable @@ -19,9 +19,6 @@ import java.io.File import java.io.IOException import java.util.concurrent.atomic.AtomicReference -/** - * - */ class VcsUserRegistryImpl internal constructor(project: Project) : Disposable, VcsUserRegistry { private val _persistentEnumerator = AtomicReference?>() private val persistentEnumerator: PersistentEnumeratorBase? diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogBigRepositoriesList.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogBigRepositoriesList.java index 831890d66250..28ecc89def56 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogBigRepositoriesList.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogBigRepositoriesList.java @@ -1,12 +1,9 @@ -// Copyright 2000-2020 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-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. package com.intellij.vcs.log.data.index; import com.intellij.openapi.Disposable; 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 com.intellij.openapi.components.StoragePathMacros; +import com.intellij.openapi.components.*; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.EventDispatcher; import com.intellij.util.xmlb.annotations.Attribute; @@ -18,6 +15,7 @@ import java.util.SortedSet; import java.util.TreeSet; @State(name = "Vcs.Log.Big.Repositories", storages = @Storage(StoragePathMacros.CACHE_FILE)) +@Service(Service.Level.APP) public final class VcsLogBigRepositoriesList implements PersistentStateComponent { @NotNull private final Object myLock = new Object(); @NotNull private final EventDispatcher myDispatcher = EventDispatcher.create(Listener.class); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java index 0c644e7006a4..bd13001089fb 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/history/FileHistoryUiProperties.java @@ -1,11 +1,8 @@ -// Copyright 2000-2020 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-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. package com.intellij.vcs.log.history; 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 com.intellij.openapi.components.StoragePathMacros; +import com.intellij.openapi.components.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcs.log.impl.VcsLogApplicationSettings; import com.intellij.vcs.log.impl.VcsLogUiProperties; @@ -21,7 +18,8 @@ import java.util.*; import static com.intellij.vcs.log.impl.CommonUiProperties.*; @State(name = "Vcs.Log.History.Properties", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) -public class FileHistoryUiProperties implements VcsLogUiProperties, PersistentStateComponent { +@Service(Service.Level.PROJECT) +public final class FileHistoryUiProperties implements VcsLogUiProperties, PersistentStateComponent { public static final VcsLogUiProperty SHOW_ALL_BRANCHES = new VcsLogUiProperty<>("Table.ShowOtherBranches"); @NotNull private final Collection myListeners = new LinkedHashSet<>(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogApplicationSettings.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogApplicationSettings.java index 471c2abf75a6..68edf12cd907 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogApplicationSettings.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogApplicationSettings.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-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. package com.intellij.vcs.log.impl; import com.intellij.openapi.components.PersistentStateComponent; @@ -20,7 +20,7 @@ import static com.intellij.vcs.log.impl.CommonUiProperties.*; import static com.intellij.vcs.log.impl.MainVcsLogUiProperties.*; @State(name = "Vcs.Log.App.Settings", storages = @Storage("vcs.xml")) -public class VcsLogApplicationSettings implements PersistentStateComponent, VcsLogUiProperties { +public final class VcsLogApplicationSettings implements PersistentStateComponent, VcsLogUiProperties { @NotNull private final Set myListeners = new LinkedHashSet<>(); private State myState = new State(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogContentProvider.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogContentProvider.java index b780014b411d..0e53d1618cd1 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogContentProvider.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogContentProvider.java @@ -36,16 +36,16 @@ public final class VcsLogContentProvider implements ChangesViewContentProvider { @NonNls public static final String TAB_NAME = "Log"; // used as tab id, not user-visible @NotNull private final VcsProjectLog myProjectLog; - @NotNull private final JPanel myContainer = new JBPanel(new BorderLayout()); + @NotNull private final JPanel myContainer = new JBPanel<>(new BorderLayout()); @Nullable private Consumer myOnCreatedListener; @Nullable private MainVcsLogUi myUi; @Nullable private Content myContent; - public VcsLogContentProvider(@NotNull Project project, @NotNull VcsProjectLog projectLog) { - myProjectLog = projectLog; + public VcsLogContentProvider(@NotNull Project project) { + myProjectLog = VcsProjectLog.getInstance(project); - MessageBusConnection connection = project.getMessageBus().connect(projectLog); + MessageBusConnection connection = project.getMessageBus().connect(myProjectLog); connection.subscribe(VcsProjectLog.VCS_PROJECT_LOG_CHANGED, new VcsProjectLog.ProjectLogListener() { @Override public void logCreated(@NotNull VcsLogManager logManager) { @@ -64,8 +64,7 @@ public final class VcsLogContentProvider implements ChangesViewContentProvider { } } - @Nullable - public MainVcsLogUi getUi() { + public @Nullable MainVcsLogUi getUi() { return myUi; } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java index 0ed16d16a7cc..140439d20fc8 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogProjectTabsProperties.java @@ -1,11 +1,8 @@ -// 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-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. package com.intellij.vcs.log.impl; 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 com.intellij.openapi.components.StoragePathMacros; +import com.intellij.openapi.components.*; import com.intellij.openapi.util.Comparing; import com.intellij.util.xmlb.annotations.Tag; import com.intellij.util.xmlb.annotations.XCollection; @@ -19,6 +16,7 @@ import static com.intellij.util.containers.ContainerUtil.emptyList; import static com.intellij.util.containers.ContainerUtil.map2List; @State(name = "Vcs.Log.Tabs.Properties", storages = @Storage(StoragePathMacros.WORKSPACE_FILE)) +@Service(Service.Level.PROJECT) public final class VcsLogProjectTabsProperties implements PersistentStateComponent, VcsLogTabsProperties { @NonNls public static final String MAIN_LOG_ID = "MAIN"; diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogSharedSettings.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogSharedSettings.java index 234f0ffa7d78..83b0387ef8d5 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogSharedSettings.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsLogSharedSettings.java @@ -1,4 +1,4 @@ -// 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. +// 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. package com.intellij.vcs.log.impl; import com.intellij.openapi.components.PersistentStateComponent; @@ -11,7 +11,7 @@ import com.intellij.util.xmlb.annotations.Attribute; import org.jetbrains.annotations.NotNull; @State(name = "Vcs.Log.Settings", storages = @Storage("vcs.xml")) -public class VcsLogSharedSettings implements PersistentStateComponent { +public final class VcsLogSharedSettings implements PersistentStateComponent { private State myState = new State(); public static final class State { diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsProjectLog.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsProjectLog.java index 08b1599f3889..e20399c811db 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsProjectLog.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/impl/VcsProjectLog.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-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. package com.intellij.vcs.log.impl; import com.intellij.ide.caches.CachesInvalidator; @@ -9,6 +9,7 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.components.Service; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.ExtensionNotApplicableException; @@ -57,7 +58,8 @@ import static com.intellij.vcs.log.VcsLogProvider.LOG_PROVIDER_EP; import static com.intellij.vcs.log.impl.CustomVcsLogUiFactoryProvider.LOG_CUSTOM_UI_FACTORY_PROVIDER_EP; import static com.intellij.vcs.log.util.PersistentUtil.LOG_CACHE; -public class VcsProjectLog implements Disposable { +@Service(Service.Level.PROJECT) +public final class VcsProjectLog implements Disposable { private static final Logger LOG = Logger.getInstance(VcsProjectLog.class); public static final Topic VCS_PROJECT_LOG_CHANGED = Topic.create("Project Vcs Log Created or Disposed", ProjectLogListener.class); @@ -241,7 +243,7 @@ public class VcsProjectLog implements Disposable { } public static VcsProjectLog getInstance(@NotNull Project project) { - return ServiceManager.getService(project, VcsProjectLog.class); + return project.getService(VcsProjectLog.class); } @Override @@ -359,7 +361,7 @@ public class VcsProjectLog implements Disposable { } static final class InitLogStartupActivity implements StartupActivity, DumbAware { - public InitLogStartupActivity() { + InitLogStartupActivity() { Application app = ApplicationManager.getApplication(); if (app.isUnitTestMode() || app.isHeadlessEnvironment()) { throw ExtensionNotApplicableException.INSTANCE; diff --git a/plugins/devkit/devkit-core/src/inspections/NonDefaultConstructorInspection.kt b/plugins/devkit/devkit-core/src/inspections/NonDefaultConstructorInspection.kt index 5de41ab3c2ad..0b3ce4647065 100644 --- a/plugins/devkit/devkit-core/src/inspections/NonDefaultConstructorInspection.kt +++ b/plugins/devkit/devkit-core/src/inspections/NonDefaultConstructorInspection.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2020 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-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. package org.jetbrains.idea.devkit.inspections import com.intellij.codeInspection.InspectionManager @@ -7,7 +7,6 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.lang.jvm.JvmClassKind import com.intellij.openapi.project.Project import com.intellij.openapi.util.NlsSafe -import com.intellij.openapi.util.text.StringUtil import com.intellij.psi.PsiClassType import com.intellij.psi.PsiModifier import com.intellij.psi.PsiParameterList @@ -30,7 +29,6 @@ import org.jetbrains.uast.convertOpt private const val serviceBeanFqn = "com.intellij.openapi.components.ServiceDescriptor" class NonDefaultConstructorInspection : DevKitUastInspectionBase(UClass::class.java) { - override fun checkClass(aClass: UClass, manager: InspectionManager, isOnTheFly: Boolean): Array? { val javaPsi = aClass.javaPsi // Groovy from test data - ignore it @@ -173,10 +171,11 @@ private fun findExtensionPointByImplementationClass(searchString: String, qualif } // todo can we use attribute `with`? +@Suppress("ReplaceJavaStaticMethodWithKotlinAnalog") @NonNls -private val ignoredTagNames = HashSet( - listOf("semContributor", "modelFacade", "scriptGenerator", "editorActionHandler", "editorTypedHandler", "dataImporter", "java.error.fix", - "explainPlanProvider")) +private val ignoredTagNames = java.util.Set.of("semContributor", "modelFacade", "scriptGenerator", + "editorActionHandler", "editorTypedHandler", + "dataImporter", "java.error.fix", "explainPlanProvider", "typeIcon") // problem - tag //