From ba74f64748edfd58a9aa08abe3bd17224427d5af Mon Sep 17 00:00:00 2001 From: Ivan Bessonov Date: Tue, 20 Sep 2016 12:05:08 +0300 Subject: [PATCH] IDEA-CR-13930 JavaLanguageLevelPusher moved to java-analysis-impl with introduction of new method. New extension point removed --- .../java-analysis-impl/java-analysis-impl.iml | 1 + .../daemon/impl/analysis/HighlightUtil.java | 14 ++++--- ...guageLevelInconsistencyMessageHandler.java | 38 ------------------- .../roots/impl/JavaLanguageLevelPusher.java | 9 +++++ .../src/META-INF/LangExtensionPoints.xml | 3 -- 5 files changed, 19 insertions(+), 46 deletions(-) delete mode 100644 java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaLanguageLevelInconsistencyMessageHandler.java rename java/{java-impl => java-analysis-impl}/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java (92%) diff --git a/java/java-analysis-impl/java-analysis-impl.iml b/java/java-analysis-impl/java-analysis-impl.iml index 6aa64154d412..ebcda34a7da5 100644 --- a/java/java-analysis-impl/java-analysis-impl.iml +++ b/java/java-analysis-impl/java-analysis-impl.iml @@ -17,6 +17,7 @@ + diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index 2fdc704c3eb8..31d03953f15b 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -38,6 +38,8 @@ import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.JavaSdkVersion; import com.intellij.openapi.roots.ProjectFileIndex; +import com.intellij.openapi.roots.impl.FilePropertyPusher; +import com.intellij.openapi.roots.impl.JavaLanguageLevelPusher; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Ref; @@ -3002,11 +3004,13 @@ public class HighlightUtil extends HighlightUtilBase { if (module != null) { LanguageLevel moduleLanguageLevel = EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(module); if (moduleLanguageLevel.isAtLeast(feature.level)) { - for (JavaLanguageLevelInconsistencyMessageHandler handler : JavaLanguageLevelInconsistencyMessageHandler.EP_NAME.getExtensions()) { - String newMessage = handler.getNewMessage(message, element, level, file); - if (newMessage != null) { - message = newMessage; - break; + for (FilePropertyPusher pusher : FilePropertyPusher.EP_NAME.getExtensions()) { + if (pusher instanceof JavaLanguageLevelPusher) { + String newMessage = ((JavaLanguageLevelPusher)pusher).getInconsistencyLanguageLevelMessage(message, element, level, file); + if (newMessage != null) { + message = newMessage; + break; + } } } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaLanguageLevelInconsistencyMessageHandler.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaLanguageLevelInconsistencyMessageHandler.java deleted file mode 100644 index 4f321ad07a30..000000000000 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaLanguageLevelInconsistencyMessageHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2000-2016 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.intellij.codeInsight.daemon.impl.analysis; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.pom.java.LanguageLevel; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @author ibessonov - */ -public interface JavaLanguageLevelInconsistencyMessageHandler { - - ExtensionPointName EP_NAME = - ExtensionPointName.create("com.intellij.javaLanguageLevelInconsistencyMessageHandler"); - - @Nullable - String getNewMessage(@NotNull String message, - @NotNull PsiElement element, - @NotNull LanguageLevel level, - @NotNull PsiFile file); -} diff --git a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java b/java/java-analysis-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java similarity index 92% rename from java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java rename to java/java-analysis-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java index 2dad1e391173..066d1c3643eb 100644 --- a/java/java-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java +++ b/java/java-analysis-impl/src/com/intellij/openapi/roots/impl/JavaLanguageLevelPusher.java @@ -26,6 +26,8 @@ import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.newvfs.FileAttribute; import com.intellij.pom.java.LanguageLevel; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; import com.intellij.util.io.DataInputOutputUtil; import com.intellij.util.messages.MessageBus; import org.jetbrains.annotations.NotNull; @@ -39,6 +41,7 @@ import java.io.IOException; * @author Gregory.Shrago */ public class JavaLanguageLevelPusher implements FilePropertyPusher { + public static void pushLanguageLevel(@NotNull final Project project) { PushedFilePropertiesUpdater.getInstance(project).pushAll(new JavaLanguageLevelPusher()); } @@ -118,4 +121,10 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher - -