mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't use constructor injection, fix NonDefaultConstructorInspection
GitOrigin-RevId: fcd2d1754e1f24634927ebf7ac4ce491d4af4cfd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
80f5b09680
commit
ae9a98fc30
@@ -1,5 +1,4 @@
|
||||
<idea-plugin>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="logProvider" interface="com.intellij.vcs.log.VcsLogProvider" area="IDEA_PROJECT" dynamic="true"/>
|
||||
<extensionPoint name="logHighlighterFactory" interface="com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory" dynamic="true"/>
|
||||
@@ -18,17 +17,12 @@
|
||||
displayNameSupplierClassName="com.intellij.vcs.log.impl.VcsLogContentProvider$DisplayNameSupplier"/>
|
||||
|
||||
<applicationService serviceImplementation="com.intellij.vcs.log.impl.VcsLogApplicationSettings"/>
|
||||
<applicationService serviceImplementation="com.intellij.vcs.log.data.index.VcsLogBigRepositoriesList"/>
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.impl.VcsLogSharedSettings"/>
|
||||
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.impl.VcsProjectLog"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.vcs.log.VcsLogObjectsFactory"
|
||||
serviceImplementation="com.intellij.vcs.log.impl.VcsLogObjectsFactoryImpl"/>
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.impl.VcsLogProjectTabsProperties"/>
|
||||
<projectService serviceInterface="com.intellij.vcs.log.VcsUserRegistry"
|
||||
serviceImplementation="com.intellij.vcs.log.data.VcsUserRegistryImpl"/>
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.history.FileHistoryUiProperties"/>
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.history.VcsDirectoryRenamesProvider"/>
|
||||
|
||||
<projectService serviceImplementation="com.intellij.vcs.log.statistics.VcsLogIndexCollector"/>
|
||||
|
||||
@@ -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<PersistentEnumeratorBase<VcsUser>?>()
|
||||
private val persistentEnumerator: PersistentEnumeratorBase<VcsUser>?
|
||||
|
||||
+3
-5
@@ -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<VcsLogBigRepositoriesList.State> {
|
||||
@NotNull private final Object myLock = new Object();
|
||||
@NotNull private final EventDispatcher<Listener> myDispatcher = EventDispatcher.create(Listener.class);
|
||||
|
||||
@@ -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<FileHistoryUiProperties.State> {
|
||||
@Service(Service.Level.PROJECT)
|
||||
public final class FileHistoryUiProperties implements VcsLogUiProperties, PersistentStateComponent<FileHistoryUiProperties.State> {
|
||||
public static final VcsLogUiProperty<Boolean> SHOW_ALL_BRANCHES = new VcsLogUiProperty<>("Table.ShowOtherBranches");
|
||||
|
||||
@NotNull private final Collection<PropertiesChangeListener> myListeners = new LinkedHashSet<>();
|
||||
|
||||
@@ -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<VcsLogApplicationSettings.State>, VcsLogUiProperties {
|
||||
public final class VcsLogApplicationSettings implements PersistentStateComponent<VcsLogApplicationSettings.State>, VcsLogUiProperties {
|
||||
@NotNull private final Set<VcsLogUiProperties.PropertiesChangeListener> myListeners = new LinkedHashSet<>();
|
||||
private State myState = new State();
|
||||
|
||||
|
||||
@@ -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<? super MainVcsLogUi> 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;
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -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<VcsLogProjectTabsProperties.State>,
|
||||
VcsLogTabsProperties {
|
||||
@NonNls public static final String MAIN_LOG_ID = "MAIN";
|
||||
|
||||
@@ -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<VcsLogSharedSettings.State> {
|
||||
public final class VcsLogSharedSettings implements PersistentStateComponent<VcsLogSharedSettings.State> {
|
||||
private State myState = new State();
|
||||
|
||||
public static final class State {
|
||||
|
||||
@@ -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<ProjectLogListener> 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;
|
||||
|
||||
@@ -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<ProblemDescriptor>? {
|
||||
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
|
||||
//<lang.elementManipulator forClass="com.intellij.psi.css.impl.CssTokenImpl"
|
||||
@@ -190,12 +189,14 @@ private fun checkAttributes(tag: XmlTag, qualifiedName: String): Boolean {
|
||||
|
||||
return tag.attributes.any {
|
||||
val name = it.name
|
||||
(name.startsWith(Extension.IMPLEMENTATION_ATTRIBUTE) || name == "instance") && it.value == qualifiedName
|
||||
// ignore lang.elementManipulator
|
||||
(name != "forClass" && name != "presentation" && name != "vcsClass") && it.value == qualifiedName
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
|
||||
@NonNls
|
||||
private val allowedServiceQualifiedNames = setOf(
|
||||
private val allowedServiceQualifiedNames = java.util.Set.of(
|
||||
"com.intellij.openapi.project.Project",
|
||||
"com.intellij.openapi.module.Module",
|
||||
"com.intellij.util.messages.MessageBus",
|
||||
@@ -203,7 +204,7 @@ private val allowedServiceQualifiedNames = setOf(
|
||||
"com.intellij.openapi.editor.actionSystem.TypedActionHandler",
|
||||
"com.intellij.database.Dbms"
|
||||
)
|
||||
private val allowedServiceNames = allowedServiceQualifiedNames.map { StringUtil.getShortName(it) }
|
||||
private val allowedServiceNames = allowedServiceQualifiedNames.mapTo(HashSet(allowedServiceQualifiedNames.size)) { it.substringAfterLast('.') }
|
||||
|
||||
@Suppress("HardCodedStringLiteral")
|
||||
private fun isAllowedParameters(list: PsiParameterList,
|
||||
|
||||
+3
-3
@@ -1,4 +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-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.lang.properties.editor;
|
||||
|
||||
import com.intellij.ide.presentation.Presentation;
|
||||
@@ -21,10 +21,10 @@ import java.util.List;
|
||||
* @author Alexey
|
||||
*/
|
||||
@Presentation(icon = "AllIcons.Nodes.ResourceBundle")
|
||||
public class ResourceBundleAsVirtualFile extends VirtualFile implements VirtualFileWithoutContent {
|
||||
public final class ResourceBundleAsVirtualFile extends VirtualFile implements VirtualFileWithoutContent {
|
||||
private final ResourceBundle myResourceBundle;
|
||||
|
||||
public ResourceBundleAsVirtualFile(@NotNull final ResourceBundle resourceBundle) {
|
||||
public ResourceBundleAsVirtualFile(@NotNull ResourceBundle resourceBundle) {
|
||||
myResourceBundle = resourceBundle;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.settingsRepository
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
@@ -10,10 +10,9 @@ import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import com.intellij.util.PathUtilRt
|
||||
import com.intellij.util.SmartList
|
||||
import com.intellij.util.Time
|
||||
import com.intellij.util.io.delete
|
||||
import com.intellij.util.io.exists
|
||||
import com.intellij.util.io.sanitizeFileName
|
||||
import com.intellij.util.io.write
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
private const val DEFAULT_COMMIT_DELAY = 10 * Time.MINUTE
|
||||
@@ -50,7 +49,7 @@ class MyPrettyPrinter : DefaultPrettyPrinter() {
|
||||
fun saveSettings(settings: IcsSettings, settingsFile: Path) {
|
||||
val serialized = ObjectMapper().writer(MyPrettyPrinter()).writeValueAsBytes(settings)
|
||||
if (serialized.size <= 2) {
|
||||
settingsFile.delete()
|
||||
Files.delete(settingsFile)
|
||||
}
|
||||
else {
|
||||
settingsFile.write(serialized)
|
||||
@@ -58,7 +57,7 @@ fun saveSettings(settings: IcsSettings, settingsFile: Path) {
|
||||
}
|
||||
|
||||
fun loadSettings(settingsFile: Path): IcsSettings {
|
||||
if (!settingsFile.exists()) {
|
||||
if (!Files.exists(settingsFile)) {
|
||||
return IcsSettings()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user