mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-13930 JavaLanguageLevelPusher moved to java-analysis-impl with introduction of new method. New extension point removed
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
<orderEntry type="module" module-name="java-analysis-api" exported="" />
|
||||
<orderEntry type="module" module-name="resources-en" />
|
||||
<orderEntry type="module" module-name="xml-psi-impl" />
|
||||
<orderEntry type="module" module-name="platform-api" />
|
||||
<orderEntry type="library" exported="" name="ASM" level="project" />
|
||||
<orderEntry type="library" name="StreamEx" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
|
||||
+9
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-38
@@ -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<JavaLanguageLevelInconsistencyMessageHandler> EP_NAME =
|
||||
ExtensionPointName.create("com.intellij.javaLanguageLevelInconsistencyMessageHandler");
|
||||
|
||||
@Nullable
|
||||
String getNewMessage(@NotNull String message,
|
||||
@NotNull PsiElement element,
|
||||
@NotNull LanguageLevel level,
|
||||
@NotNull PsiFile file);
|
||||
}
|
||||
+9
@@ -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<LanguageLevel> {
|
||||
|
||||
public static void pushLanguageLevel(@NotNull final Project project) {
|
||||
PushedFilePropertiesUpdater.getInstance(project).pushAll(new JavaLanguageLevelPusher());
|
||||
}
|
||||
@@ -118,4 +121,10 @@ public class JavaLanguageLevelPusher implements FilePropertyPusher<LanguageLevel
|
||||
@Override
|
||||
public void afterRootsChanged(@NotNull Project project) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getInconsistencyLanguageLevelMessage(@NotNull String message, @NotNull PsiElement element,
|
||||
@NotNull LanguageLevel level, @NotNull PsiFile file) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -881,9 +881,6 @@
|
||||
|
||||
<extensionPoint name="projectViewNestingRulesProvider"
|
||||
interface="com.intellij.ide.projectView.ProjectViewNestingRulesProvider"/>
|
||||
|
||||
<extensionPoint name="javaLanguageLevelInconsistencyMessageHandler"
|
||||
interface="com.intellij.codeInsight.daemon.impl.analysis.JavaLanguageLevelInconsistencyMessageHandler"/>
|
||||
</extensionPoints>
|
||||
</idea-plugin>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user