From 5933433cd5d0f2ee67d92077ec6d496dcca50255 Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Fri, 24 Apr 2020 14:07:56 +0200 Subject: [PATCH] FilePropertyPusher - cleanup FilePropertyPusher#initExtra method API (remove MessageBus parameter) we do not have any usages of the method with messageBus parameter, added new method without it and delegated to the previous one for backward compatibility GitOrigin-RevId: 2bf2eb051adc81ad386c1f06288b5fd889d16514 --- .../impl/PushedFilePropertiesUpdaterImpl.java | 2 +- .../roots/impl/FilePropertyPusher.java | 33 +++++++++---------- .../psi/impl/PythonLanguageLevelPusher.java | 2 +- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java index b588ab6b61f9..e8ea9f4693fb 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java @@ -149,7 +149,7 @@ public final class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesU @Override public void initializeProperties() { FilePropertyPusher.EP_NAME.forEachExtensionSafe(pusher -> { - pusher.initExtra(myProject, myProject.getMessageBus()); + pusher.initExtra(myProject); }); } diff --git a/platform/projectModel-api/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java b/platform/projectModel-api/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java index 3434360d8b42..96f96f1e48b6 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java +++ b/platform/projectModel-api/src/com/intellij/openapi/roots/impl/FilePropertyPusher.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 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-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. package com.intellij.openapi.roots.impl; @@ -67,7 +53,9 @@ import java.io.IOException; public interface FilePropertyPusher { ExtensionPointName> EP_NAME = ExtensionPointName.create("com.intellij.filePropertyPusher"); - default void initExtra(@NotNull Project project, @NotNull MessageBus bus) { } + default void initExtra(@NotNull Project project) { + initExtra(project, project.getMessageBus()); + } default void afterRootsChanged(@NotNull Project project) {} @@ -105,8 +93,7 @@ public interface FilePropertyPusher { // /** - * @deprecated - * use {@link FilePropertyPusher#initExtra(Project, MessageBus)} instead + * @deprecated use {@link FilePropertyPusher#initExtra(Project)} instead */ @ApiStatus.ScheduledForRemoval(inVersion = "2021.3") @Deprecated @@ -135,5 +122,15 @@ public interface FilePropertyPusher { return false; } + + /** + * @deprecated use {@link #initExtra(Project)} + */ + @Deprecated + @SuppressWarnings({"unused", "DeprecatedIsStillUsed"}) + default void initExtra(@NotNull Project project, @NotNull MessageBus bus) { + DeprecatedMethodException.report("Please override FilePropertyPusher#initExtra(Project)"); + } + // } diff --git a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java index 38a6e255126a..f11f5c018859 100644 --- a/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java +++ b/python/python-psi-impl/src/com/jetbrains/python/psi/impl/PythonLanguageLevelPusher.java @@ -76,7 +76,7 @@ public class PythonLanguageLevelPusher implements FilePropertyPusher moduleSdks = getPythonModuleSdks(project); final Set distinctSdks = StreamEx.ofValues(moduleSdks).nonNull().collect(Collectors.toCollection(LinkedHashSet::new));