This commit is contained in:
Alexey Kudravtsev
2015-07-15 16:48:49 +03:00
parent 0003911c23
commit fdb7afe963
28 changed files with 132 additions and 81 deletions
@@ -68,7 +68,7 @@ public class JavaSdkImpl extends JavaSdk {
super("JavaSDK");
fileManager.addVirtualFileListener(new VirtualFileAdapter() {
@Override
public void fileDeleted(@NotNull VirtualFileEvent event) {
updateCache(event);
}
@@ -500,6 +500,7 @@ public class JavaSdkImpl extends JavaSdk {
return sdkVersion != null && sdkVersion.isAtLeast(version);
}
@NotNull
@Override
public Sdk createJdk(@NotNull String jdkName, @NotNull String home, boolean isJre) {
ProjectJdkImpl jdk = new ProjectJdkImpl(jdkName, this);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -32,6 +32,7 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType {
return ApplicationManager.getApplication().getComponent(JavaSdk.class);
}
@NotNull
public final Sdk createJdk(@NotNull String jdkName, @NotNull String jreHome) {
return createJdk(jdkName, jreHome, true);
}
@@ -41,6 +42,7 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType {
*/
public abstract int compareTo(@NotNull String versionString, @NotNull String versionNumber);
@NotNull
public abstract Sdk createJdk(@NonNls String jdkName, @NotNull String home, boolean isJre);
@Nullable
@@ -51,16 +53,16 @@ public abstract class JavaSdk extends SdkType implements JavaSdkType {
public abstract boolean isOfVersionOrHigher(@NotNull Sdk sdk, @NotNull JavaSdkVersion version);
public static boolean checkForJdk(File file) {
public static boolean checkForJdk(@NotNull File file) {
return JdkUtil.checkForJdk(file);
}
public static boolean checkForJre(String file) {
public static boolean checkForJre(@NotNull String file) {
return JdkUtil.checkForJre(file);
}
@Nullable
public static String getJdkVersion(final String sdkHome) {
public static String getJdkVersion(@NotNull String sdkHome) {
return SdkVersionUtil.detectJdkVersion(sdkHome);
}
}
@@ -21,6 +21,7 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.impl.JavaPsiFacadeEx;
import org.jetbrains.annotations.NotNull;
/**
* A TestCase for single PsiFile being opened in Editor conversion. See configureXXX and checkResultXXX method docs.
@@ -49,6 +50,7 @@ public abstract class LightCodeInsightTestCase extends LightPlatformCodeInsightT
return IdeaTestUtil.getMockJdk17();
}
@NotNull
@Override
protected ModuleType getModuleType() {
return StdModuleTypes.JAVA;
@@ -19,6 +19,7 @@ import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.impl.JavaPsiFacadeEx;
import org.jetbrains.annotations.NotNull;
/**
* A test case that provides IDEA application and project. Note both are reused for each test run in the session so
@@ -39,6 +40,7 @@ public abstract class LightIdeaTestCase extends LightPlatformTestCase {
return IdeaTestUtil.getMockJdk17();
}
@NotNull
@Override
protected ModuleType getModuleType() {
return StdModuleTypes.JAVA;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -25,11 +25,13 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
/**
* @author peter
*/
public class DefaultLightProjectDescriptor implements LightProjectDescriptor {
@NotNull
@Override
public ModuleType getModuleType() {
return StdModuleTypes.JAVA;
@@ -41,7 +43,7 @@ public class DefaultLightProjectDescriptor implements LightProjectDescriptor {
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
LanguageLevelModuleExtension extension = model.getModuleExtension(LanguageLevelModuleExtension.class);
if (extension != null) {
extension.setLanguageLevel(LanguageLevel.HIGHEST);
@@ -39,25 +39,25 @@ import java.io.File;
public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase{
public static final LightProjectDescriptor JAVA_1_4 = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_4);
}
};
public static final LightProjectDescriptor JAVA_1_5 = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_5);
}
};
public static final LightProjectDescriptor JAVA_1_6 = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_6);
}
};
public static final LightProjectDescriptor JAVA_1_7 = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_7);
}
};
@@ -68,7 +68,7 @@ public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase{
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_8);
}
};
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -38,21 +38,21 @@ public abstract class JdkVersionDetector {
* @return version string of {@code null} if version cannot be determined
*/
@Nullable
public abstract String detectJdkVersion(String homePath);
public abstract String detectJdkVersion(@NotNull String homePath);
@Nullable
public abstract String detectJdkVersion(String homePath, ActionRunner actionRunner);
public abstract String detectJdkVersion(@NotNull String homePath, @NotNull ActionRunner actionRunner);
@Nullable
public abstract JdkVersionInfo detectJdkVersionInfo(String homePath);
public abstract JdkVersionInfo detectJdkVersionInfo(@NotNull String homePath);
@Nullable
public abstract JdkVersionInfo detectJdkVersionInfo(String homePath, ActionRunner actionRunner);
public abstract JdkVersionInfo detectJdkVersionInfo(@NotNull String homePath, @NotNull ActionRunner actionRunner);
@Deprecated
@Nullable
public abstract String readVersionFromProcessOutput(String homePath, String[] command, String versionLineMarker,
ActionRunner actionRunner);
public abstract String readVersionFromProcessOutput(@NotNull String homePath, @NotNull String[] command, String versionLineMarker,
@NotNull ActionRunner actionRunner);
//todo[nik] replace with a service with difference implementation for IDEA and for JPS process (need to exclude jps-builders module from IDEA classpath)
public interface ActionRunner {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -17,6 +17,7 @@ package org.jetbrains.jps.model.java.impl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Bitness;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.JdkVersionDetector;
import org.jetbrains.jps.service.SharedThreadPool;
@@ -39,12 +40,12 @@ public class JdkVersionDetectorImpl extends JdkVersionDetector {
@Override
@Nullable
public String detectJdkVersion(String homePath) {
public String detectJdkVersion(@NotNull String homePath) {
return detectJdkVersion(homePath, ACTION_RUNNER);
}
@Nullable
public String detectJdkVersion(String homePath, final ActionRunner actionRunner) {
public String detectJdkVersion(@NotNull String homePath, @NotNull final ActionRunner actionRunner) {
JdkVersionInfo info = detectJdkVersionInfo(homePath, actionRunner);
if (info != null) {
return info.getVersion();
@@ -53,18 +54,18 @@ public class JdkVersionDetectorImpl extends JdkVersionDetector {
}
@Override
public JdkVersionInfo detectJdkVersionInfo(String homePath) {
public JdkVersionInfo detectJdkVersionInfo(@NotNull String homePath) {
return detectJdkVersionInfo(homePath, ACTION_RUNNER);
}
@Override
public JdkVersionInfo detectJdkVersionInfo(String homePath, ActionRunner actionRunner) {
public JdkVersionInfo detectJdkVersionInfo(@NotNull String homePath, @NotNull ActionRunner actionRunner) {
String[] command = {homePath + File.separator + "bin" + File.separator + "java", "-version"};
return readVersionInfoFromProcessOutput(homePath, command, null, actionRunner);
}
public String readVersionFromProcessOutput(String homePath, String[] command, String versionLineMarker,
ActionRunner actionRunner) {
public String readVersionFromProcessOutput(@NotNull String homePath, @NotNull String[] command, String versionLineMarker,
@NotNull ActionRunner actionRunner) {
JdkVersionInfo info = readVersionInfoFromProcessOutput(homePath, command, versionLineMarker, actionRunner);
if (info != null) {
return info.getVersion();
@@ -72,8 +73,8 @@ public class JdkVersionDetectorImpl extends JdkVersionDetector {
return null;
}
private static JdkVersionInfo readVersionInfoFromProcessOutput(String homePath, String[] command, String versionLineMarker, ActionRunner actionRunner) {
if (homePath == null || !new File(homePath).exists()) {
private static JdkVersionInfo readVersionInfoFromProcessOutput(@NotNull String homePath, @NotNull String[] command, String versionLineMarker, @NotNull ActionRunner actionRunner) {
if (!new File(homePath).exists()) {
return null;
}
try {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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.
@@ -24,6 +24,7 @@ package com.intellij.openapi.projectRoots.impl;
import com.intellij.openapi.application.ApplicationManager;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.JdkVersionDetector;
@@ -42,17 +43,17 @@ public class SdkVersionUtil {
@Deprecated
@Nullable
public static String readVersionFromProcessOutput(String homePath, @NonNls String[] command, @NonNls String versionLineMarker) {
public static String readVersionFromProcessOutput(@NotNull String homePath, @NonNls @NotNull String[] command, @NonNls String versionLineMarker) {
return JdkVersionDetector.getInstance().readVersionFromProcessOutput(homePath, command, versionLineMarker, ACTION_RUNNER);
}
@Nullable
public static String detectJdkVersion(String homePath) {
public static String detectJdkVersion(@NotNull String homePath) {
return JdkVersionDetector.getInstance().detectJdkVersion(homePath, ACTION_RUNNER);
}
@Nullable
public static JdkVersionDetector.JdkVersionInfo getJdkVersionInfo(String homePath) {
public static JdkVersionDetector.JdkVersionInfo getJdkVersionInfo(@NotNull String homePath) {
return JdkVersionDetector.getInstance().detectJdkVersionInfo(homePath, ACTION_RUNNER);
}
}
@@ -255,11 +255,13 @@ public class SdkConfigurationUtil {
return null;
}
public static String createUniqueSdkName(SdkType type, String home, final Collection<Sdk> sdks) {
@NotNull
public static String createUniqueSdkName(@NotNull SdkType type, String home, final Collection<Sdk> sdks) {
return createUniqueSdkName(type.suggestSdkName(null, home), sdks);
}
public static String createUniqueSdkName(final String suggestedName, final Collection<Sdk> sdks) {
@NotNull
public static String createUniqueSdkName(@NotNull String suggestedName, @NotNull Collection<Sdk> sdks) {
final Set<String> names = new HashSet<String>();
for (Sdk jdk : sdks) {
names.add(jdk.getName());
@@ -272,7 +274,7 @@ public class SdkConfigurationUtil {
return newSdkName;
}
public static void selectSdkHome(final SdkType sdkType, @NotNull final Consumer<String> consumer) {
public static void selectSdkHome(@NotNull final SdkType sdkType, @NotNull final Consumer<String> consumer) {
final FileChooserDescriptor descriptor = sdkType.getHomeChooserDescriptor();
if (ApplicationManager.getApplication().isUnitTestMode()) {
Sdk sdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(sdkType);
@@ -298,12 +300,13 @@ public class SdkConfigurationUtil {
}
@Nullable
public static VirtualFile getSuggestedSdkRoot(SdkType sdkType) {
public static VirtualFile getSuggestedSdkRoot(@NotNull SdkType sdkType) {
final String homePath = sdkType.suggestHomePath();
return homePath == null ? null : LocalFileSystem.getInstance().findFileByPath(homePath);
}
public static List<String> filterExistingPaths(SdkType sdkType, Collection<String> sdkHomes, final Sdk[] sdks) {
@NotNull
public static List<String> filterExistingPaths(@NotNull SdkType sdkType, Collection<String> sdkHomes, final Sdk[] sdks) {
List<String> result = new ArrayList<String>();
for (String sdkHome : sdkHomes) {
if (findByPath(sdkType, sdks, sdkHome) == null) {
@@ -314,7 +317,7 @@ public class SdkConfigurationUtil {
}
@Nullable
private static Sdk findByPath(SdkType sdkType, Sdk[] sdks, String sdkHome) {
private static Sdk findByPath(@NotNull SdkType sdkType, @NotNull Sdk[] sdks, @NotNull String sdkHome) {
for (Sdk sdk : sdks) {
final String path = sdk.getHomePath();
if (sdk.getSdkType() == sdkType && path != null &&
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* 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.
@@ -21,16 +21,19 @@ import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import org.jetbrains.annotations.NotNull;
/**
* @author yole
*/
public interface LightProjectDescriptor {
@NotNull
ModuleType getModuleType();
Sdk getSdk();
void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry);
void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry);
class Empty implements LightProjectDescriptor {
@NotNull
@Override
public ModuleType getModuleType() {
return EmptyModuleType.getInstance();
@@ -42,7 +45,7 @@ public interface LightProjectDescriptor {
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -31,6 +31,7 @@ public abstract class PluginModuleTestCase extends LightCodeInsightFixtureTestCa
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new DefaultLightProjectDescriptor() {
@NotNull
@Override
public ModuleType getModuleType() {
return PluginModuleType.getInstance();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -23,6 +23,7 @@ import com.intellij.openapi.roots.libraries.Library
import com.intellij.openapi.vfs.JarFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
import org.jetbrains.annotations.NotNull
import static org.jetbrains.plugins.groovy.config.GroovyFacetUtil.getBundledGroovyJar
import static org.jetbrains.plugins.groovy.util.TestUtils.*
@@ -43,7 +44,7 @@ class GroovyLightProjectDescriptor extends DefaultLightProjectDescriptor {
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.moduleLibraryTable.createLibrary("GROOVY").modifiableModel;
final VirtualFile groovyJar = JarFileSystem.instance.refreshAndFindFileByPath("${myLibPath}!/");
assert groovyJar != null;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -37,7 +37,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
class GrCompletionWithLibraryTest extends GroovyCompletionTestBase {
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.moduleLibraryTable.createLibrary("GROOVY").modifiableModel;
final VirtualFile groovyJar = JarFileSystem.instance.refreshAndFindFileByPath(TestUtils.mockGroovy1_7LibraryName + "!/");
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* 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.
@@ -35,7 +35,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
public class GroovyDslTest extends LightCodeInsightFixtureTestCase {
private static descriptor = new DefaultLightProjectDescriptor() {
@Override
void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
PsiTestUtil.addLibrary(module, model, "GROOVY", TestUtils.getMockGroovyLibraryHome(), TestUtils.GROOVY_JAR);
}
}
@@ -1,3 +1,18 @@
/*
* 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.
*/
package org.jetbrains.plugins.groovy.dsl
import com.intellij.openapi.module.Module
import com.intellij.openapi.roots.ContentEntry
@@ -13,7 +28,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
*/
class GroovyTransformationsTest extends LightCodeInsightFixtureTestCase {
static def descriptor = new DefaultLightProjectDescriptor() {
@Override def void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
@Override def void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
PsiTestUtil.addLibrary(module, model, "GROOVY", TestUtils.getMockGroovy1_7LibraryHome(), TestUtils.GROOVY_JAR_17);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* 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.
@@ -24,6 +24,7 @@ import com.intellij.openapi.vfs.JarFileSystem
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUntypedAccessInspection
import org.jetbrains.plugins.groovy.util.TestUtils
@@ -161,7 +162,7 @@ target (default : '') {
}
class GantProjectDescriptor extends DefaultLightProjectDescriptor {
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
def fs = JarFileSystem.instance
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* 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.
@@ -34,7 +34,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
public class StandaloneGantTest extends LightCodeInsightFixtureTestCase {
public static final DefaultLightProjectDescriptor GROOVY_17_PROJECT_DESCRIPTOR = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
final VirtualFile groovyJar = JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_7LibraryName() + "!/");
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* 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.
@@ -43,7 +43,7 @@ abstract class AbstractGebLightTestCase extends LightCodeInsightFixtureTestCase
}
class GebProjectDescriptor extends DefaultLightProjectDescriptor {
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
def fs = JarFileSystem.instance
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* 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.
@@ -41,7 +41,7 @@ public class ConvertConcatenationToGstringTest extends GrIntentionTestCase {
@NotNull
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.moduleLibraryTable.createLibrary("GROOVY").modifiableModel;
final VirtualFile groovyJar = JarFileSystem.instance.refreshAndFindFileByPath(TestUtils.mockGroovy1_7LibraryName + "!/");
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
@@ -1,3 +1,18 @@
/*
* 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.
*/
package org.jetbrains.plugins.groovy.intentions.style.parameterToEntry;
import com.intellij.openapi.module.Module;
@@ -34,7 +49,7 @@ public class ParameterToMapEntryTest extends GroovyFormatterTestCase {
public static final DefaultLightProjectDescriptor GROOVY_17_PROJECT_DESCRIPTOR = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
final VirtualFile groovyJar = JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_7LibraryName()+"!/");
assert groovyJar != null;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* 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.
@@ -25,6 +25,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAssignmentOfMemberOfRawTypeInspection
import org.jetbrains.plugins.groovy.util.TestUtils
@@ -34,7 +35,7 @@ import org.jetbrains.plugins.groovy.util.TestUtils
class GroovyMapAttributeTest extends LightCodeInsightFixtureTestCase {
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.moduleLibraryTable.createLibrary("GROOVY").modifiableModel;
final VirtualFile groovyJar = JarFileSystem.instance.refreshAndFindFileByPath(TestUtils.mockGroovy1_7LibraryName + "!/");
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
@@ -26,13 +26,14 @@ import com.intellij.psi.impl.compiled.ClsClassImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.groovy.util.TestUtils
class GrLibrarySourceHighlightingTest extends GrHighlightingTestBase {
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final absoluteBasePath = "${TestUtils.absoluteTestDataPath}${basePath}"
final lib = JarFileSystem.instance.refreshAndFindFileByPath("$absoluteBasePath/some-library.jar!/")
final src = LocalFileSystem.instance.refreshAndFindFileByPath("$absoluteBasePath/src/")
@@ -1,17 +1,17 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* 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
* 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
* 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.
* 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 org.jetbrains.plugins.groovy.lang.highlighting
import com.intellij.codeInspection.LocalInspectionTool
@@ -36,7 +36,7 @@ public class Groovy16HighlightingTest extends LightCodeInsightFixtureTestCase {
@NotNull
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.moduleLibraryTable.createLibrary("GROOVY").modifiableModel
final VirtualFile groovyJar = JarFileSystem.instance.refreshAndFindFileByPath("$TestUtils.mockGroovy1_6LibraryName!/")
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES)
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* 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.
@@ -24,6 +24,7 @@ import com.intellij.openapi.vfs.JarFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiMethod
import com.intellij.testFramework.LightProjectDescriptor
import org.jetbrains.annotations.NotNull
import org.jetbrains.plugins.groovy.GroovyLightProjectDescriptor
import org.jetbrains.plugins.groovy.LightGroovyTestCase
import org.jetbrains.plugins.groovy.util.TestUtils
@@ -37,7 +38,7 @@ public class NavigateDelegatedClsMethodsTest extends LightGroovyTestCase {
final LightProjectDescriptor projectDescriptor = new GroovyLightProjectDescriptor(TestUtils.mockGroovy2_1LibraryName) {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
super.configureModule(module, model, contentEntry)
final Library.ModifiableModel gebModel = model.moduleLibraryTable.createLibrary("Geb").modifiableModel;
@@ -19,13 +19,11 @@ import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
import org.junit.Assume;
/**
* User: anna
@@ -34,7 +32,7 @@ import org.junit.Assume;
public abstract class AbstractJavaFXTestCase extends LightCodeInsightFixtureTestCase {
public static final DefaultLightProjectDescriptor JAVA_FX_DESCRIPTOR = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar");
super.configureModule(module, model, contentEntry);
}
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.psi.xml.XmlFile;
import com.intellij.testFramework.LightProjectDescriptor;
import com.intellij.testFramework.PsiTestUtil;
@@ -29,14 +28,13 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.fxml.codeInsight.inspections.JavaFxUnresolvedFxIdReferenceInspection;
import org.jetbrains.plugins.javaFX.fxml.codeInsight.intentions.JavaFxInjectPageLanguageIntention;
import org.junit.Assume;
import java.util.Set;
public class JavaFXQuickfixTest extends LightCodeInsightFixtureTestCase {
public static final DefaultLightProjectDescriptor JAVA_FX_WITH_GROOVY_DESCRIPTOR = new DefaultLightProjectDescriptor() {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "jfxrt.jar");
PsiTestUtil.addLibrary(module, model, "javafx", PluginPathManager.getPluginHomePath("javaFX") + "/testData", "groovy-1.8.0.jar");
super.configureModule(module, model, contentEntry);
@@ -28,6 +28,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.PythonMockSdk;
import com.jetbrains.python.PythonModuleTypeBase;
import org.jetbrains.annotations.NotNull;
/**
* Project descriptor (extracted from {@link com.jetbrains.python.fixtures.PyTestCase}) and should be used with it.
@@ -40,6 +41,7 @@ public class PyLightProjectDescriptor implements LightProjectDescriptor {
myPythonVersion = pythonVersion;
}
@NotNull
@Override
public ModuleType getModuleType() {
return PythonModuleTypeBase.getInstance();
@@ -51,7 +53,7 @@ public class PyLightProjectDescriptor implements LightProjectDescriptor {
}
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
}
protected void createLibrary(ModifiableRootModel model, final String name, final String path) {