mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
search for functional interfaces in java 8 modules only
This commit is contained in:
+3
-3
@@ -16,7 +16,7 @@
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -48,8 +48,8 @@ public class ContentEntriesEditor extends JavaContentEntriesEditor {
|
||||
protected void addAdditionalSettingsToPanel(final JPanel mainPanel) {
|
||||
myLanguageLevelConfigurable = new LanguageLevelConfigurable() {
|
||||
@Override
|
||||
public LanguageLevelModuleExtension getLanguageLevelExtension() {
|
||||
return getModel().getModuleExtension(LanguageLevelModuleExtension.class);
|
||||
public LanguageLevelModuleExtensionImpl getLanguageLevelExtension() {
|
||||
return getModel().getModuleExtension(LanguageLevelModuleExtensionImpl.class);
|
||||
}
|
||||
};
|
||||
mainPanel.add(myLanguageLevelConfigurable.createComponent(), BorderLayout.NORTH);
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -78,5 +78,5 @@ public abstract class LanguageLevelConfigurable implements UnnamedConfigurable {
|
||||
myLanguageLevelCombo = null;
|
||||
}
|
||||
|
||||
public abstract LanguageLevelModuleExtension getLanguageLevelExtension();
|
||||
public abstract LanguageLevelModuleExtensionImpl getLanguageLevelExtension();
|
||||
}
|
||||
|
||||
+2
-1
@@ -925,7 +925,8 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
|
||||
modifiableRootModel.getModuleExtension(CompilerModuleExtension.class).inheritCompilerOutputPath(true);
|
||||
|
||||
modifiableRootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevelModuleExtension.getInstance(rootModel.getModule()).getLanguageLevel());
|
||||
modifiableRootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(
|
||||
LanguageLevelModuleExtensionImpl.getInstance(rootModel.getModule()).getLanguageLevel());
|
||||
|
||||
for (OrderEntry entry : rootModel.getOrderEntries()) {
|
||||
if (entry instanceof JdkOrderEntry) continue;
|
||||
|
||||
+2
-1
@@ -17,6 +17,7 @@ package com.intellij.openapi.module;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -25,7 +26,7 @@ public class EffectiveLanguageLevelUtil {
|
||||
@NotNull
|
||||
public static LanguageLevel getEffectiveLanguageLevel(@NotNull final Module module) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
LanguageLevelModuleExtension moduleLevel = LanguageLevelModuleExtension.getInstance(module);
|
||||
LanguageLevelModuleExtension moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module);
|
||||
LanguageLevel level = moduleLevel == null ? null : moduleLevel.getLanguageLevel();
|
||||
if (level != null) return level;
|
||||
return LanguageLevelProjectExtension.getInstance(module.getProject()).getLanguageLevel();
|
||||
|
||||
+17
-15
@@ -29,42 +29,38 @@ import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelModuleExtension> {
|
||||
public class LanguageLevelModuleExtensionImpl extends ModuleExtension<LanguageLevelModuleExtensionImpl> implements LanguageLevelModuleExtension {
|
||||
@NonNls private static final String LANGUAGE_LEVEL_ELEMENT_NAME = "LANGUAGE_LEVEL";
|
||||
private Module myModule;
|
||||
private final boolean myWritable;
|
||||
private static final Logger LOG = Logger.getInstance("#" + LanguageLevelModuleExtension.class.getName());
|
||||
|
||||
public static LanguageLevelModuleExtension getInstance(final Module module) {
|
||||
return ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtension.class);
|
||||
}
|
||||
private static final Logger LOG = Logger.getInstance("#" + LanguageLevelModuleExtensionImpl.class.getName());
|
||||
|
||||
private LanguageLevel myLanguageLevel;
|
||||
private final LanguageLevelModuleExtension mySource;
|
||||
private final LanguageLevelModuleExtensionImpl mySource;
|
||||
|
||||
public LanguageLevelModuleExtension(Module module) {
|
||||
public static LanguageLevelModuleExtensionImpl getInstance(final Module module) {
|
||||
return ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtensionImpl.class);
|
||||
}
|
||||
|
||||
public LanguageLevelModuleExtensionImpl(Module module) {
|
||||
myModule = module;
|
||||
mySource = null;
|
||||
myWritable = false;
|
||||
}
|
||||
|
||||
public LanguageLevelModuleExtension(final LanguageLevelModuleExtension source, boolean writable) {
|
||||
public LanguageLevelModuleExtensionImpl(final LanguageLevelModuleExtensionImpl source, boolean writable) {
|
||||
myWritable = writable;
|
||||
myModule = source.myModule;
|
||||
myLanguageLevel = source.myLanguageLevel;
|
||||
mySource = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLanguageLevel(final LanguageLevel languageLevel) {
|
||||
LOG.assertTrue(myWritable, "Writable model can be retrieved from writable ModifiableRootModel");
|
||||
myLanguageLevel = languageLevel;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LanguageLevel getLanguageLevel() {
|
||||
return myLanguageLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
final String languageLevel = element.getAttributeValue(LANGUAGE_LEVEL_ELEMENT_NAME);
|
||||
@@ -90,7 +86,7 @@ public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelM
|
||||
|
||||
@Override
|
||||
public ModuleExtension getModifiableModel(final boolean writable) {
|
||||
return new LanguageLevelModuleExtension(this, writable);
|
||||
return new LanguageLevelModuleExtensionImpl(this, writable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,4 +107,10 @@ public class LanguageLevelModuleExtension extends ModuleExtension<LanguageLevelM
|
||||
myModule = null;
|
||||
myLanguageLevel = null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LanguageLevel getLanguageLevel() {
|
||||
return myLanguageLevel;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class IncreaseLanguageLevelFix implements IntentionAction {
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
LOG.assertTrue(virtualFile != null);
|
||||
final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
|
||||
final LanguageLevel moduleLevel = module == null ? null : LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
|
||||
final LanguageLevel moduleLevel = module == null ? null : LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
|
||||
if (moduleLevel != null && isLanguageLevelAcceptable(project, module, myLevel)) {
|
||||
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
|
||||
rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(myLevel);
|
||||
|
||||
+2
-2
@@ -64,7 +64,7 @@ public class InconsistentLanguageLevelInspection extends GlobalInspectionTool {
|
||||
|
||||
LanguageLevel projectLanguageLevel = LanguageLevelProjectExtension.getInstance(manager.getProject()).getLanguageLevel();
|
||||
for (Module module : modules) {
|
||||
LanguageLevel languageLevel = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
|
||||
LanguageLevel languageLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
|
||||
if (languageLevel == null) {
|
||||
languageLevel = projectLanguageLevel;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class InconsistentLanguageLevelInspection extends GlobalInspectionTool {
|
||||
if (!(entry instanceof ModuleOrderEntry)) continue;
|
||||
final Module dependantModule = ((ModuleOrderEntry)entry).getModule();
|
||||
if (dependantModule == null) continue;
|
||||
LanguageLevel dependantLanguageLevel = LanguageLevelModuleExtension.getInstance(dependantModule).getLanguageLevel();
|
||||
LanguageLevel dependantLanguageLevel = LanguageLevelModuleExtensionImpl.getInstance(dependantModule).getLanguageLevel();
|
||||
if (dependantLanguageLevel == null) {
|
||||
dependantLanguageLevel = projectLanguageLevel;
|
||||
}
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.util.Function;
|
||||
@@ -46,7 +47,7 @@ public class LanguageLevelUsagesCollector extends AbstractApplicationUsagesColle
|
||||
|
||||
final Set<String> languageLevels = new HashSet<String>();
|
||||
for (Module module : ModuleManager.getInstance(project).getModules()) {
|
||||
final LanguageLevelModuleExtension instance = LanguageLevelModuleExtension.getInstance(module);
|
||||
final LanguageLevelModuleExtension instance = LanguageLevelModuleExtensionImpl.getInstance(module);
|
||||
final LanguageLevel languageLevel = instance.getLanguageLevel();
|
||||
if (languageLevel != null) {
|
||||
languageLevels.add(languageLevel.toString());
|
||||
|
||||
+32
-5
@@ -16,8 +16,14 @@
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.impl.scopes.ModulesScope;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.java.stubs.JavaMethodElementType;
|
||||
import com.intellij.psi.impl.java.stubs.index.JavaMethodParameterTypesIndex;
|
||||
@@ -31,10 +37,12 @@ import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.QueryExecutor;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFunctionalExpression, FunctionalExpressionSearch.SearchParameters> {
|
||||
|
||||
@@ -42,10 +50,26 @@ public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFuncti
|
||||
public boolean execute(@NotNull final FunctionalExpressionSearch.SearchParameters queryParameters,
|
||||
@NotNull final Processor<PsiFunctionalExpression> consumer) {
|
||||
final PsiClass aClass = queryParameters.getElementToSearch();
|
||||
final Set<Module> highLevelModules = new HashSet<Module>();
|
||||
if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return !LambdaUtil.isFunctionalClass(aClass) || !PsiUtil.isLanguageLevel8OrHigher(aClass);
|
||||
if (LambdaUtil.isFunctionalClass(aClass)) {
|
||||
final Project project = aClass.getProject();
|
||||
final boolean projectLevelIsHigh = PsiUtil.getLanguageLevel(project).isAtLeast(LanguageLevel.JDK_1_8);
|
||||
|
||||
for (Module module : ModuleManager.getInstance(project).getModules()) {
|
||||
final LanguageLevelModuleExtension extension = ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtension.class);
|
||||
if (extension != null) {
|
||||
final LanguageLevel level = extension.getLanguageLevel();
|
||||
if (level == null && projectLevelIsHigh || level != null && level.isAtLeast(LanguageLevel.JDK_1_8)) {
|
||||
highLevelModules.add(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
return highLevelModules.isEmpty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
})) {
|
||||
return true;
|
||||
@@ -55,12 +79,13 @@ public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFuncti
|
||||
public SearchScope compute() {
|
||||
return queryParameters.getEffectiveSearchScope();
|
||||
}
|
||||
}), consumer);
|
||||
}), consumer, highLevelModules);
|
||||
}
|
||||
|
||||
public static boolean collectFunctionalExpressions(final PsiClass aClass,
|
||||
final SearchScope searchScope,
|
||||
final Processor<PsiFunctionalExpression> consumer) {
|
||||
final Processor<PsiFunctionalExpression> consumer,
|
||||
final Set<Module> highLevelModules) {
|
||||
final SearchScope classScope = ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
|
||||
@Override
|
||||
public SearchScope compute() {
|
||||
@@ -74,7 +99,8 @@ public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFuncti
|
||||
}
|
||||
});
|
||||
final Project project = PsiUtilCore.getProjectInReadAction(aClass);
|
||||
final GlobalSearchScope scope = useScope instanceof GlobalSearchScope ? (GlobalSearchScope)useScope : new EverythingGlobalScope(project);
|
||||
final GlobalSearchScope scope = new ModulesScope(highLevelModules, project)
|
||||
.intersectWith(useScope instanceof GlobalSearchScope ? (GlobalSearchScope)useScope : new EverythingGlobalScope(project));
|
||||
final Collection<PsiMethod> lambdaCandidates = ApplicationManager.getApplication().runReadAction(new Computable<Collection<PsiMethod>>() {
|
||||
@Override
|
||||
public Collection<PsiMethod> compute() {
|
||||
@@ -82,7 +108,8 @@ public class JavaFunctionalExpressionSearcher implements QueryExecutor<PsiFuncti
|
||||
final GlobalSearchScope useClassScope = classScope instanceof GlobalSearchScope ? (GlobalSearchScope)classScope : scope;
|
||||
JavaMethodParameterTypesIndex parameterTypesIndex = JavaMethodParameterTypesIndex.getInstance();
|
||||
LinkedHashSet<PsiMethod> methods = new LinkedHashSet<PsiMethod>(parameterTypesIndex.get(functionalInterfaceName, project, useClassScope));
|
||||
methods.addAll(parameterTypesIndex.get(JavaMethodElementType.TYPE_PARAMETER_PSEUDO_NAME, project, GlobalSearchScope.allScope(project)));
|
||||
methods.addAll(parameterTypesIndex.get(JavaMethodElementType.TYPE_PARAMETER_PSEUDO_NAME, project,
|
||||
GlobalSearchScope.allScope(project)));
|
||||
return methods;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.openapi.roots;
|
||||
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface LanguageLevelModuleExtension {
|
||||
void setLanguageLevel(LanguageLevel languageLevel);
|
||||
@Nullable
|
||||
LanguageLevel getLanguageLevel();
|
||||
}
|
||||
+3
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.refactoring.BaseRefactoringProcessor;
|
||||
import com.intellij.refactoring.ChangeSignatureBaseTest;
|
||||
import com.intellij.refactoring.changeSignature.ParameterInfoImpl;
|
||||
import com.intellij.refactoring.changeSignature.ThrownExceptionInfo;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
|
||||
public class ChangeSignatureTouchLambdaTest extends ChangeSignatureBaseTest {
|
||||
|
||||
|
||||
@@ -23,10 +23,7 @@ import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.SdkModificator;
|
||||
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -51,7 +48,7 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
final LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(module.getProject());
|
||||
|
||||
final LanguageLevel projectLevel = projectExt.getLanguageLevel();
|
||||
final LanguageLevel moduleLevel = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
|
||||
final LanguageLevel moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
|
||||
try {
|
||||
projectExt.setLanguageLevel(level);
|
||||
setModuleLanguageLevel(module, level);
|
||||
@@ -64,7 +61,8 @@ public class IdeaTestUtil extends PlatformTestUtil {
|
||||
}
|
||||
|
||||
public static void setModuleLanguageLevel(Module module, final LanguageLevel level) {
|
||||
final LanguageLevelModuleExtension modifiable = (LanguageLevelModuleExtension)LanguageLevelModuleExtension.getInstance(module).getModifiableModel(true);
|
||||
final LanguageLevelModuleExtensionImpl
|
||||
modifiable = (LanguageLevelModuleExtensionImpl)LanguageLevelModuleExtensionImpl.getInstance(module).getModifiableModel(true);
|
||||
modifiable.setLanguageLevel(level);
|
||||
modifiable.commit();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.openapi.module.impl.scopes;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
|
||||
public class ModulesScope extends GlobalSearchScope {
|
||||
|
||||
private final ProjectFileIndex myProjectFileIndex;
|
||||
private final Set<Module> myModules;
|
||||
|
||||
public ModulesScope(@NotNull Set<Module> modules, Project project) {
|
||||
super(project);
|
||||
myProjectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
myModules = modules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(@NotNull VirtualFile file) {
|
||||
Module moduleOfFile = myProjectFileIndex.getModuleForFile(file);
|
||||
return moduleOfFile != null && myModules.contains(moduleOfFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSearchInModuleContent(@NotNull Module aModule) {
|
||||
return myModules.contains(aModule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSearchInLibraries() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "Modules:" + Arrays.toString(myModules.toArray(new Module[myModules.size()]));
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class IdeaSpecificSettings extends AbstractIdeaSpecificSettings<Modifiabl
|
||||
|
||||
@Override
|
||||
protected void readLanguageLevel(Element root, ModifiableRootModel model) throws InvalidDataException {
|
||||
model.getModuleExtension(LanguageLevelModuleExtension.class).readExternal(root);
|
||||
model.getModuleExtension(LanguageLevelModuleExtensionImpl.class).readExternal(root);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,7 +277,7 @@ public class IdeaSpecificSettings extends AbstractIdeaSpecificSettings<Modifiabl
|
||||
isModified = true;
|
||||
}
|
||||
|
||||
final LanguageLevelModuleExtension languageLevelModuleExtension = model.getModuleExtension(LanguageLevelModuleExtension.class);
|
||||
final LanguageLevelModuleExtensionImpl languageLevelModuleExtension = model.getModuleExtension(LanguageLevelModuleExtensionImpl.class);
|
||||
final LanguageLevel languageLevel = languageLevelModuleExtension.getLanguageLevel();
|
||||
if (languageLevel != null) {
|
||||
languageLevelModuleExtension.writeExternal(root);
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JdkUtil;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -108,7 +108,7 @@ public class GroovyHotSwapper extends JavaProgramPatcher {
|
||||
if (configuration instanceof ModuleBasedConfiguration) {
|
||||
final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
|
||||
if (module != null) {
|
||||
final LanguageLevel level = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
|
||||
final LanguageLevel level = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
|
||||
if (level != null && !level.isAtLeast(LanguageLevel.JDK_1_5)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ public abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestC
|
||||
} else {
|
||||
PsiTestUtil.addContentRoot(dep, depRoot);
|
||||
}
|
||||
IdeaTestUtil.setModuleLanguageLevel(dep, LanguageLevelModuleExtension.getInstance(myModule).getLanguageLevel());
|
||||
IdeaTestUtil.setModuleLanguageLevel(dep, LanguageLevelModuleExtensionImpl.getInstance(myModule).getLanguageLevel());
|
||||
|
||||
result.setResult(dep);
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
@@ -834,7 +834,7 @@ public class StructureImportingTest extends MavenImportingTestCase {
|
||||
}
|
||||
|
||||
private LanguageLevel getLanguageLevelForModule() {
|
||||
return LanguageLevelModuleExtension.getInstance(getModule("project")).getLanguageLevel();
|
||||
return LanguageLevelModuleExtensionImpl.getInstance(getModule("project")).getLanguageLevel();
|
||||
}
|
||||
|
||||
public void testSettingTargetLevel() throws Exception {
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
|
||||
<copyPastePostProcessor implementation="com.intellij.codeInsight.editorActions.CopyPasteFoldingProcessor"/>
|
||||
|
||||
<moduleExtension implementation="com.intellij.openapi.roots.LanguageLevelModuleExtension"/>
|
||||
<moduleExtension implementation="com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl"/>
|
||||
<moduleExtension implementation="com.intellij.openapi.roots.impl.JavaModuleExternalPathsImpl"/>
|
||||
|
||||
<orderRootType implementation="com.intellij.openapi.roots.AnnotationOrderRootType"/>
|
||||
|
||||
Reference in New Issue
Block a user