IJPL-310 mark extensions as obsolete (part 10)

GitOrigin-RevId: 5091c58ed62bccf2eefa765cdee1316b77e93b93
This commit is contained in:
Vladimir Krivosheev
2023-10-26 12:34:52 +02:00
committed by intellij-monorepo-bot
parent 944a537a85
commit 4c010ba621
6 changed files with 34 additions and 51 deletions

View File

@@ -694,7 +694,7 @@ public final class DocumentImpl extends UserDataHolderBase implements DocumentEx
throw new ReadOnlyModificationException(this, CoreBundle.message("attempt.to.modify.read.only.document.error.message")); throw new ReadOnlyModificationException(this, CoreBundle.message("attempt.to.modify.read.only.document.error.message"));
} }
for (DocumentWriteAccessGuard guard : DocumentWriteAccessGuard.EP_NAME.getExtensions()) { for (DocumentWriteAccessGuard guard : DocumentWriteAccessGuard.EP_NAME.getExtensionList()) {
DocumentWriteAccessGuard.Result result = guard.isWritable(this); DocumentWriteAccessGuard.Result result = guard.isWritable(this);
if (!result.isSuccess()) { if (!result.isSuccess()) {
throw new ReadOnlyModificationException( throw new ReadOnlyModificationException(

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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diff; package com.intellij.diff;
import com.intellij.diff.chains.DiffRequestChain; import com.intellij.diff.chains.DiffRequestChain;
@@ -102,7 +102,7 @@ public class DiffManagerImpl extends DiffManagerEx {
@Override @Override
public List<DiffTool> getDiffTools() { public List<DiffTool> getDiffTools() {
List<DiffTool> result = new ArrayList<>(); List<DiffTool> result = new ArrayList<>();
Collections.addAll(result, DiffTool.EP_NAME.getExtensions()); result.addAll(DiffTool.EP_NAME.getExtensionList());
result.add(SimpleDiffTool.INSTANCE); result.add(SimpleDiffTool.INSTANCE);
result.add(UnifiedDiffTool.INSTANCE); result.add(UnifiedDiffTool.INSTANCE);
result.add(BinaryDiffTool.INSTANCE); result.add(BinaryDiffTool.INSTANCE);

View File

@@ -26,8 +26,8 @@ import kotlin.Unit;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import static com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowEventLogGroup.*; import static com.intellij.internal.statistic.collectors.fus.actions.persistence.ToolWindowEventLogGroup.*;
@@ -43,7 +43,7 @@ import static com.intellij.openapi.wm.ToolWindowId.*;
* *
* <p> * <p>
* If toolwindow is registered dynamically is <b>should</b> be explicitly whitelisted * If toolwindow is registered dynamically is <b>should</b> be explicitly whitelisted
* in plugin.xml {@link #EP_NAME} or here in {@link ToolWindowCollector#ourToolwindowAllowList} * in plugin.xml {@link #EP_NAME} or here in {@link ToolWindowCollector#toolwindowAllowList}
* </p> * </p>
*/ */
public final class ToolWindowCollector { public final class ToolWindowCollector {
@@ -63,12 +63,15 @@ public final class ToolWindowCollector {
* If toolwindow is registered in plugin.xml, it's whitelisted automatically. <br/> * If toolwindow is registered in plugin.xml, it's whitelisted automatically. <br/>
* To whitelist dynamically registered plugin toolwindow use {@link #EP_NAME} * To whitelist dynamically registered plugin toolwindow use {@link #EP_NAME}
*/ */
private static final Map<String, PluginInfo> ourToolwindowAllowList = new HashMap<>(); private static final Map<String, PluginInfo> toolwindowAllowList = new HashMap<>();
static { static {
Arrays.asList(MESSAGES_WINDOW, DEBUG, RUN, FIND, HIERARCHY, ANALYZE_DEPENDENCIES, MODULES_DEPENDENCIES, DUPLICATES, EXTRACT_METHOD, for (String id : List.of(MESSAGES_WINDOW, DEBUG, RUN, FIND, HIERARCHY, ANALYZE_DEPENDENCIES, MODULES_DEPENDENCIES, DUPLICATES,
DOCUMENTATION, PREVIEW, SERVICES, ENDPOINTS, BuildContentManager.TOOL_WINDOW_ID, "CVS", BUILD_DEPENDENCIES) EXTRACT_METHOD,
.forEach(id -> ourToolwindowAllowList.put(id, getPlatformPlugin())); DOCUMENTATION, PREVIEW, SERVICES, ENDPOINTS, BuildContentManager.TOOL_WINDOW_ID, "CVS",
BUILD_DEPENDENCIES)) {
toolwindowAllowList.put(id, getPlatformPlugin());
}
} }
private ToolWindowCollector() { private ToolWindowCollector() {
@@ -87,7 +90,7 @@ public final class ToolWindowCollector {
private static void addToolwindowToWhitelist(@NotNull ToolWindowAllowlistEP extension, @NotNull PluginDescriptor pluginDescriptor) { private static void addToolwindowToWhitelist(@NotNull ToolWindowAllowlistEP extension, @NotNull PluginDescriptor pluginDescriptor) {
PluginInfo info = PluginInfoDetectorKt.getPluginInfoByDescriptor(pluginDescriptor); PluginInfo info = PluginInfoDetectorKt.getPluginInfoByDescriptor(pluginDescriptor);
if (info.isDevelopedByJetBrains()) { if (info.isDevelopedByJetBrains()) {
ourToolwindowAllowList.put(extension.id, info); toolwindowAllowList.put(extension.id, info);
} }
} }
@@ -132,21 +135,21 @@ public final class ToolWindowCollector {
} }
private static @NotNull PluginInfo getToolWindowInfo(@NotNull String toolWindowId) { private static @NotNull PluginInfo getToolWindowInfo(@NotNull String toolWindowId) {
if (ourToolwindowAllowList.containsKey(toolWindowId)) { if (toolwindowAllowList.containsKey(toolWindowId)) {
return ourToolwindowAllowList.get(toolWindowId); return toolwindowAllowList.get(toolWindowId);
} }
PluginInfo info = getToolWindowInfo(toolWindowId, ToolWindowEP.EP_NAME.getExtensions()); PluginInfo info = getToolWindowInfo(toolWindowId, ToolWindowEP.EP_NAME.getExtensionList());
if (info == null) { if (info == null) {
info = getToolWindowInfo(toolWindowId, LibraryDependentToolWindow.EXTENSION_POINT_NAME.getExtensions()); info = getToolWindowInfo(toolWindowId, LibraryDependentToolWindow.EXTENSION_POINT_NAME.getExtensionList());
} }
if (info == null) { if (info == null) {
info = getToolWindowInfo(toolWindowId, FacetDependentToolWindow.EXTENSION_POINT_NAME.getExtensions()); info = getToolWindowInfo(toolWindowId, FacetDependentToolWindow.EXTENSION_POINT_NAME.getExtensionList());
} }
return info != null ? info : getUnknownPlugin(); return info != null ? info : getUnknownPlugin();
} }
private static @Nullable PluginInfo getToolWindowInfo(@NotNull String toolWindowId, ToolWindowEP @NotNull [] toolWindows) { private static @Nullable PluginInfo getToolWindowInfo(@NotNull String toolWindowId, @NotNull List<? extends ToolWindowEP> toolWindows) {
for (ToolWindowEP ep : toolWindows) { for (ToolWindowEP ep : toolWindows) {
if (StringUtil.equals(toolWindowId, ep.id)) { if (StringUtil.equals(toolWindowId, ep.id)) {
PluginDescriptor pluginDescriptor = ep.getPluginDescriptor(); PluginDescriptor pluginDescriptor = ep.getPluginDescriptor();

View File

@@ -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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.remoteServer.impl.configuration.deployment; package com.intellij.remoteServer.impl.configuration.deployment;
import com.intellij.configurationStore.ComponentSerializationUtil; import com.intellij.configurationStore.ComponentSerializationUtil;
@@ -6,7 +6,6 @@ import com.intellij.execution.ExecutionException;
import com.intellij.execution.Executor; import com.intellij.execution.Executor;
import com.intellij.execution.configurations.*; import com.intellij.execution.configurations.*;
import com.intellij.execution.runners.ExecutionEnvironment; import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.SettingsEditor; import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.options.SettingsEditorGroup; import com.intellij.openapi.options.SettingsEditorGroup;
@@ -203,7 +202,7 @@ public class DeployToServerRunConfiguration<S extends ServerConfiguration, D ext
@Nullable @Nullable
private static DeploymentSourceType<?> findDeploymentSourceType(@Nullable String id) { private static DeploymentSourceType<?> findDeploymentSourceType(@Nullable String id) {
for (DeploymentSourceType<?> type : DeploymentSourceType.EP_NAME.getExtensions()) { for (DeploymentSourceType<?> type : DeploymentSourceType.EP_NAME.getExtensionList()) {
if (type.getId().equals(id)) { if (type.getId().equals(id)) {
return type; return type;
} }

View File

@@ -1,18 +1,4 @@
/* // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2000-2017 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.
*/
package com.jetbrains.javascript.debugger package com.jetbrains.javascript.debugger
import com.intellij.javascript.debugger.ExpressionInfoFactory import com.intellij.javascript.debugger.ExpressionInfoFactory
@@ -33,7 +19,7 @@ import org.jetbrains.debugger.MemberFilter
*/ */
abstract class JavaScriptDebugAware { abstract class JavaScriptDebugAware {
companion object { companion object {
val EP_NAME: ExtensionPointName<JavaScriptDebugAware> = ExtensionPointName.create("com.jetbrains.javaScriptDebugAware") val EP_NAME: ExtensionPointName<JavaScriptDebugAware> = ExtensionPointName("com.jetbrains.javaScriptDebugAware")
@JvmStatic @JvmStatic
fun isBreakpointAware(fileType: FileType): Boolean { fun isBreakpointAware(fileType: FileType): Boolean {
@@ -42,12 +28,7 @@ abstract class JavaScriptDebugAware {
} }
fun getBreakpointAware(fileType: FileType): JavaScriptDebugAware? { fun getBreakpointAware(fileType: FileType): JavaScriptDebugAware? {
for (debugAware in EP_NAME.extensions) { return EP_NAME.extensionList.firstOrNull { fileType == it.fileType }
if (fileType == debugAware.fileType) {
return debugAware
}
}
return null
} }
} }
@@ -58,8 +39,8 @@ abstract class JavaScriptDebugAware {
get() = null get() = null
/** /**
* Return false if you language could be natively executed in the VM * Return false if your language could be natively executed in the VM
* You must not specify it and it doesn't matter if you use not own breakpoint type - (Kotlin or GWT use java breakpoint type, for example) * You must not specify it, and it doesn't matter if you use not own breakpoint type - (Kotlin or GWT use a java breakpoint type, for example)
*/ */
open val isOnlySourceMappedBreakpoints: Boolean open val isOnlySourceMappedBreakpoints: Boolean
get() = true get() = true

View File

@@ -1,19 +1,19 @@
// 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.vcs.impl package com.intellij.openapi.vcs.impl
import com.intellij.openapi.vcs.AbstractVcs import com.intellij.openapi.vcs.AbstractVcs
import com.intellij.openapi.vcs.checkin.BaseCheckinHandlerFactory import com.intellij.openapi.vcs.checkin.BaseCheckinHandlerFactory
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory
import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory import com.intellij.openapi.vcs.checkin.VcsCheckinHandlerFactory
import com.intellij.util.containers.ContainerUtil.unmodifiableOrEmptyList import kotlinx.collections.immutable.mutate
import kotlinx.collections.immutable.persistentListOf
class CheckinHandlersManagerImpl : CheckinHandlersManager() { class CheckinHandlersManagerImpl : CheckinHandlersManager() {
override fun getRegisteredCheckinHandlerFactories(vcses: Array<AbstractVcs>): List<BaseCheckinHandlerFactory> { override fun getRegisteredCheckinHandlerFactories(vcses: Array<AbstractVcs>): List<BaseCheckinHandlerFactory> {
val vcsesKeys = vcses.mapTo(mutableSetOf()) { it.keyInstanceMethod } val vcsesKeys = vcses.mapTo(HashSet()) { it.keyInstanceMethod }
return persistentListOf<BaseCheckinHandlerFactory>().mutate { builder ->
return unmodifiableOrEmptyList( VcsCheckinHandlerFactory.EP_NAME.extensionList.filterTo(builder) { it.key in vcsesKeys }
VcsCheckinHandlerFactory.EP_NAME.extensions.filter { it.key in vcsesKeys } + builder.addAll(CheckinHandlerFactory.EP_NAME.extensionList)
CheckinHandlerFactory.EP_NAME.extensions }
)
} }
} }