Produciton code uses a shared application between many projects.

Tests always dispose the application together with JetCoreEnvironment
This commit is contained in:
Andrey Breslav
2013-10-11 21:53:54 +04:00
parent e8142d6464
commit 1d540181b0
29 changed files with 96 additions and 47 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.jet.buildtools.core;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Function;
@@ -65,7 +66,7 @@ public class BytecodeCompiler {
private JetCoreEnvironment env(String stdlib, String[] classpath, String[] sourceRoots) {
CompilerConfiguration configuration = createConfiguration(stdlib, classpath, sourceRoots);
return new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), configuration);
return JetCoreEnvironment.createForProduction(Disposer.newDisposable(), configuration);
}
private CompilerConfiguration createConfiguration(String stdlib, String[] classpath, String[] sourceRoots) {
@@ -75,7 +75,7 @@ public class K2JSCompiler extends CLICompiler<K2JSCompilerArguments> {
CompilerConfiguration configuration = new CompilerConfiguration();
configuration.addAll(CommonConfigurationKeys.SOURCE_ROOTS_KEY, Arrays.asList(arguments.sourceFiles));
JetCoreEnvironment environmentForJS = new JetCoreEnvironment(rootDisposable, configuration);
JetCoreEnvironment environmentForJS = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
Project project = environmentForJS.getProject();
@@ -140,11 +140,11 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
}
else if (arguments.script) {
List<String> scriptArgs = arguments.freeArgs.subList(1, arguments.freeArgs.size());
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
KotlinToJVMBytecodeCompiler.compileAndExecuteScript(paths, environment, scriptArgs);
}
else {
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(rootDisposable, configuration);
KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment, jar, outputDir, arguments.includeRuntime);
}
return OK;
@@ -118,7 +118,7 @@ public class CompileEnvironmentUtil {
List<Module> modules;
try {
JetCoreEnvironment scriptEnvironment = new JetCoreEnvironment(disposable, configuration);
JetCoreEnvironment scriptEnvironment = JetCoreEnvironment.createForProduction(disposable, configuration);
GenerationState generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(scriptEnvironment);
if (generationState == null) {
throw new CompileEnvironmentException("Module script " + moduleScriptFile + " analyze failed:\n" +
@@ -29,6 +29,7 @@ import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElementFinder;
import com.intellij.psi.PsiFile;
@@ -36,6 +37,7 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy;
import com.intellij.psi.impl.file.impl.JavaFileManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import org.jetbrains.jet.CompilerModeProvider;
import org.jetbrains.jet.OperationModeProvider;
import org.jetbrains.jet.asJava.JavaElementFinder;
@@ -64,10 +66,50 @@ import static org.jetbrains.jet.cli.common.messages.CompilerMessageSeverity.WARN
public class JetCoreEnvironment {
private final JavaCoreApplicationEnvironment applicationEnvironment;
private static final Object APPLICATION_LOCK = new Object();
private static JavaCoreApplicationEnvironment ourApplicationEnvironment;
@NotNull
private JavaCoreApplicationEnvironment initApplication(@NotNull Disposable parentDisposable) {
public static JetCoreEnvironment createForProduction(@NotNull Disposable parentDisposable, @NotNull CompilerConfiguration configuration) {
return new JetCoreEnvironment(parentDisposable, getOrCreateApplicationEnvironmentForProduction(), configuration);
}
@TestOnly
@NotNull
public static JetCoreEnvironment createForTests(@NotNull Disposable parentDisposable, @NotNull CompilerConfiguration configuration) {
return new JetCoreEnvironment(parentDisposable, createApplicationEnvironment(parentDisposable), configuration);
}
@NotNull
private static JavaCoreApplicationEnvironment getOrCreateApplicationEnvironmentForProduction() {
synchronized (APPLICATION_LOCK) {
if (ourApplicationEnvironment != null) return ourApplicationEnvironment;
Disposable parentDisposable = Disposer.newDisposable();
ourApplicationEnvironment = createApplicationEnvironment(parentDisposable);
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
synchronized (APPLICATION_LOCK) {
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourApplicationEnvironment = null;
}
}
});
return ourApplicationEnvironment;
}
}
public static void disposeApplicationEnvironment() {
synchronized (APPLICATION_LOCK) {
if (ourApplicationEnvironment == null) return;
JavaCoreApplicationEnvironment environment = ourApplicationEnvironment;
ourApplicationEnvironment = null;
Disposer.dispose(environment.getParentDisposable());
}
}
private static JavaCoreApplicationEnvironment createApplicationEnvironment(Disposable parentDisposable) {
JavaCoreApplicationEnvironment applicationEnvironment = new JavaCoreApplicationEnvironment(parentDisposable);
// ability to get text from annotations xml files
@@ -81,6 +123,7 @@ public class JetCoreEnvironment {
applicationEnvironment.registerParserDefinition(new JetParserDefinition());
applicationEnvironment.getApplication().registerService(OperationModeProvider.class, new CompilerModeProvider());
return applicationEnvironment;
}
@@ -92,12 +135,14 @@ public class JetCoreEnvironment {
private final CompilerConfiguration configuration;
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerConfiguration configuration) {
private JetCoreEnvironment(
@NotNull Disposable parentDisposable,
@NotNull JavaCoreApplicationEnvironment applicationEnvironment,
@NotNull CompilerConfiguration configuration
) {
this.configuration = configuration.copy();
this.configuration.setReadOnly(true);
this.applicationEnvironment = initApplication(parentDisposable);
projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment);
MockProject project = projectEnvironment.getProject();
@@ -140,9 +185,14 @@ public class JetCoreEnvironment {
return configuration;
}
@NotNull
private CoreApplicationEnvironment getMyApplicationEnvironment() {
return projectEnvironment.getEnvironment();
}
@NotNull
public MockApplication getApplication() {
return applicationEnvironment.getApplication();
return getMyApplicationEnvironment().getApplication();
}
@NotNull
@@ -168,7 +218,7 @@ public class JetCoreEnvironment {
}
}
else {
VirtualFile fileByPath = applicationEnvironment.getLocalFileSystem().findFileByPath(file.getAbsolutePath());
VirtualFile fileByPath = getMyApplicationEnvironment().getLocalFileSystem().findFileByPath(file.getAbsolutePath());
if (fileByPath != null) {
PsiFile psiFile = PsiManager.getInstance(getProject()).findFile(fileByPath);
if (psiFile instanceof JetFile) {
@@ -183,7 +233,7 @@ public class JetCoreEnvironment {
return;
}
VirtualFile vFile = applicationEnvironment.getLocalFileSystem().findFileByPath(path);
VirtualFile vFile = getMyApplicationEnvironment().getLocalFileSystem().findFileByPath(path);
if (vFile == null) {
report(ERROR, "Source file or directory not found: " + path);
return;
@@ -198,7 +248,7 @@ public class JetCoreEnvironment {
private void addToClasspath(File path) {
if (path.isFile()) {
VirtualFile jarFile = applicationEnvironment.getJarFileSystem().findFileByPath(path + "!/");
VirtualFile jarFile = getMyApplicationEnvironment().getJarFileSystem().findFileByPath(path + "!/");
if (jarFile == null) {
report(WARNING, "Classpath entry points to a file that is not a JAR archive: " + path);
return;
@@ -207,7 +257,7 @@ public class JetCoreEnvironment {
classPath.add(jarFile);
}
else {
VirtualFile root = applicationEnvironment.getLocalFileSystem().findFileByPath(path.getAbsolutePath());
VirtualFile root = getMyApplicationEnvironment().getLocalFileSystem().findFileByPath(path.getAbsolutePath());
if (root == null) {
report(WARNING, "Classpath entry points to a non-existent location: " + path);
return;
@@ -100,7 +100,7 @@ public class KotlinToJVMBytecodeCompiler {
Disposable parentDisposable = CompileEnvironmentUtil.createMockDisposable();
JetCoreEnvironment moduleEnvironment = null;
try {
moduleEnvironment = new JetCoreEnvironment(parentDisposable, compilerConfiguration);
moduleEnvironment = JetCoreEnvironment.createForProduction(parentDisposable, compilerConfiguration);
GenerationState generationState = analyzeAndGenerate(moduleEnvironment);
@@ -338,7 +338,7 @@ public class KotlinToJVMBytecodeCompiler {
scriptDefinitions != null ? scriptDefinitions : Collections.<JetScriptDefinition>emptyList());
compilerConfiguration.put(JVMConfigurationKeys.SCRIPT_PARAMETERS, scriptParameters);
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, compilerConfiguration);
JetCoreEnvironment environment = JetCoreEnvironment.createForProduction(rootDisposable, compilerConfiguration);
try {
JetScriptDefinitionProvider.getInstance(environment.getProject()).markFileAsScript(environment.getSourceFiles().get(0));
@@ -93,7 +93,7 @@ public class ReplInterpreter {
private final ModuleDescriptorImpl module;
public ReplInterpreter(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) {
jetCoreEnvironment = new JetCoreEnvironment(disposable, configuration);
jetCoreEnvironment = JetCoreEnvironment.createForProduction(disposable, configuration);
Project project = jetCoreEnvironment.getProject();
trace = new BindingTraceContext();
module = AnalyzerFacadeForJVM.createJavaModule("<repl>");
@@ -52,7 +52,6 @@ import org.jetbrains.jet.lang.diagnostics.Severity;
import org.jetbrains.jet.lang.diagnostics.rendering.DefaultErrorMessages;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiFactory;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.resolve.*;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.lazy.LazyResolveTestUtil;
@@ -241,7 +240,7 @@ public class JetTestUtils {
@NotNull ConfigurationKind configurationKind,
@NotNull TestJdkKind jdkKind
) {
return new JetCoreEnvironment(disposable, compilerConfigurationForTests(
return JetCoreEnvironment.createForTests(disposable, compilerConfigurationForTests(
configurationKind, jdkKind, getAnnotationsJar(), getAnnotationsExtJar()));
}
@@ -36,7 +36,7 @@ public abstract class KotlinAsJavaTestBase extends KotlinTestWithEnvironment {
configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, root.getPath());
}
return new JetCoreEnvironment(getTestRootDisposable(), configuration);
return JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration);
}
protected abstract List<File> getKotlinSourceRoots();
@@ -71,15 +71,12 @@ public abstract class AbstractJetDiagnosticsTest extends JetLiteFixture {
catch (IOException e) {
throw ExceptionUtils.rethrow(e);
}
return new JetCoreEnvironment(
getTestRootDisposable(),
JetTestUtils.compilerConfigurationForTests(
return JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_AND_ANNOTATIONS,
TestJdkKind.MOCK_JDK,
Arrays.asList(JetTestUtils.getAnnotationsJar()),
Arrays.asList(javaFilesDir)
)
);
));
}
private static boolean writeJavaFile(@NotNull String fileName, @NotNull String content, @NotNull File javaFilesDir) {
@@ -56,7 +56,7 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte
assert !sourceFiles.isEmpty() : getTestName(true) + " should contains at least one .kt file";
Collections.sort(sourceFiles);
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, Arrays.asList(JetTestUtils.getAnnotationsJar()), classPath));
loadFiles(sourceFiles.toArray(new String[sourceFiles.size()]));
@@ -40,7 +40,7 @@ public class ClassPathInParentClassLoaderTest extends CodegenTestCase {
public void testKt2781() throws Exception {
File javaClassesTempDirectory = compileJava("classPathInParentClassLoader/kt2781.java");
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
loadFile("classPathInParentClassLoader/kt2781.kt");
@@ -51,7 +51,7 @@ public class GenerateNotNullAssertionsTest extends CodegenTestCase {
configuration.put(JVMConfigurationKeys.GENERATE_NOT_NULL_ASSERTIONS, generateAssertions);
configuration.put(JVMConfigurationKeys.GENERATE_NOT_NULL_PARAMETER_ASSERTIONS, generateParamAssertions);
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), configuration);
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration);
}
private void doTestGenerateAssertions(boolean generateAssertions) throws Exception {
@@ -36,7 +36,7 @@ public class JUnitUsageGenTest extends CodegenTestCase {
throw new AssertionError("JUnit jar wasn't found");
}
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, junitJar));
}
@@ -56,7 +56,7 @@ public class LineNumberTest extends TestCaseWithTmpdir {
@NotNull
private JetCoreEnvironment createEnvironment() {
return new JetCoreEnvironment(myTestRootDisposable, JetTestUtils
return JetCoreEnvironment.createForTests(myTestRootDisposable, JetTestUtils
.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), tmpdir));
}
@@ -85,7 +85,7 @@ public class OuterClassGenTest extends CodegenTestCase {
private void doTest(@NotNull String kotlinName, @NotNull String javaName) throws Exception {
File javaClassesTempDirectory = compileJava("outerClassInfo/outerClassInfo.java");
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
UrlClassLoader javaClassLoader = new UrlClassLoader(new URL[] {javaClassesTempDirectory.toURI().toURL()}, getClass().getClassLoader());
@@ -98,7 +98,7 @@ public class TestlibTest extends UsefulTestCase {
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY,
new MessageCollectorPlainTextToStream(System.out, MessageCollectorPlainTextToStream.NON_VERBOSE));
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), configuration);
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration);
generationState = KotlinToJVMBytecodeCompiler.analyzeAndGenerate(myEnvironment);
if (generationState == null) {
@@ -79,7 +79,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
String ktFile = ktFileFullPath.substring("compiler/testData/codegen/".length());
File javaClassesTempDirectory = compileJava(ktFile.replaceFirst("\\.kt$", ".java"));
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
myEnvironment = JetCoreEnvironment.createForTests(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
loadFile(ktFile);
@@ -78,7 +78,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends TestCaseWit
private void compileB(@NotNull File ktBFile) throws IOException {
CompilerConfiguration configurationWithADirInClasspath = JetTestUtils
.compilerConfigurationForTests(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), aDir);
compileKotlin(ktBFile, bDir, new JetCoreEnvironment(getTestRootDisposable(), configurationWithADirInClasspath),
compileKotlin(ktBFile, bDir, JetCoreEnvironment.createForTests(getTestRootDisposable(), configurationWithADirInClasspath),
getTestRootDisposable());
}
@@ -141,7 +141,7 @@ public abstract class AbstractLoadJavaTest extends TestCaseWithTmpdir {
ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, tmpdir);
configuration.put(CommonConfigurationKeys.SOURCE_ROOTS_KEY, Arrays.asList(sourcesDir.getAbsolutePath()));
configuration.add(JVMConfigurationKeys.CLASSPATH_KEY, new File("compiler/tests")); // for @ExpectLoadError annotation
JetCoreEnvironment environment = new JetCoreEnvironment(getTestRootDisposable(), configuration);
JetCoreEnvironment environment = JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration);
// we need the same binding trace for resolve from Java and Kotlin
BindingTrace trace = CliLightClassGenerationSupport.getInstanceForCli(environment.getProject()).getTrace();
@@ -24,6 +24,7 @@ import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.MockLibraryUtil;
import org.jetbrains.jet.TestJdkKind;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
import org.jetbrains.jet.config.CompilerConfiguration;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
import org.jetbrains.jet.lang.descriptors.VariableDescriptorForObject;
@@ -92,8 +93,9 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
extras.addAll(extraClassPath);
extras.add(JetTestUtils.getAnnotationsJar());
return new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, extras.toArray(new File[extras.size()])));
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, extras.toArray(new File[extras.size()]));
return JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration);
}
@NotNull
@@ -69,7 +69,7 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
CompilerConfiguration configuration = JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.FULL_JDK, JetTestUtils.getAnnotationsJar());
configuration.add(JVMConfigurationKeys.ANNOTATIONS_PATH_KEY, new File("ideaSDK/lib/jdkAnnotations.jar"));
return new JetCoreEnvironment(parentDisposable, configuration);
return JetCoreEnvironment.createForTests(parentDisposable, configuration);
}
@Override
@@ -95,7 +95,7 @@ public final class LoadDescriptorUtil {
javaRoot,
new File("compiler/tests") // for @ExpectLoadError annotation
);
JetCoreEnvironment jetCoreEnvironment = new JetCoreEnvironment(disposable, configuration);
JetCoreEnvironment jetCoreEnvironment = JetCoreEnvironment.createForTests(disposable, configuration);
BindingTraceContext trace = new BindingTraceContext();
InjectorForJavaDescriptorResolver injector = new InjectorForJavaDescriptorResolver(jetCoreEnvironment.getProject(), trace);
NamespaceDescriptor namespaceDescriptor =
@@ -145,13 +145,13 @@ public class ResolveDescriptorsFromExternalLibraries {
JetCoreEnvironment jetCoreEnvironment;
if (jar != null) {
jetCoreEnvironment = new JetCoreEnvironment(junk, JetTestUtils.compilerConfigurationForTests(
jetCoreEnvironment = JetCoreEnvironment.createForTests(junk, JetTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), jar));
}
else {
CompilerConfiguration configuration =
JetTestUtils.compilerConfigurationForTests(ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.FULL_JDK);
jetCoreEnvironment = new JetCoreEnvironment(junk, configuration);
jetCoreEnvironment = JetCoreEnvironment.createForTests(junk, configuration);
if (!PathUtil.findRtJar().equals(jar)) {
throw new RuntimeException("rt.jar mismatch: " + jar + ", " + PathUtil.findRtJar());
}
@@ -97,7 +97,7 @@ public class JetPsiUtilTest extends JetLiteFixture {
@Override
protected JetCoreEnvironment createEnvironment() {
return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration());
return JetCoreEnvironment.createForTests(getTestRootDisposable(), new CompilerConfiguration());
}
private ImportPath getImportPathFromParsed(String text) {
@@ -47,7 +47,7 @@ public class BuiltInsSerializer {
try {
List<File> sourceFiles = FileUtil.findFilesByMask(Pattern.compile(".*\\.kt"), new File(BUILT_INS_SRC_DIR));
CompilerConfiguration configuration = new CompilerConfiguration();
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
JetCoreEnvironment environment = JetCoreEnvironment.createForTests(rootDisposable, configuration);
List<JetFile> files = JetTestUtils.loadToJetFiles(environment, sourceFiles);
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(files, environment, false);
@@ -72,7 +72,7 @@ public class GenerateJavaToKotlinMethodMap {
Disposable disposable = CompileEnvironmentUtil.createMockDisposable();
try {
JetCoreEnvironment coreEnvironment = new JetCoreEnvironment(disposable, configuration);
JetCoreEnvironment coreEnvironment = JetCoreEnvironment.createForProduction(disposable, configuration);
StringBuilder buf = new StringBuilder();
Printer printer = new Printer(buf);
@@ -65,6 +65,6 @@ public abstract class AbstractJetPsiMatcherTest extends JetLiteFixture {
@Override
protected JetCoreEnvironment createEnvironment() {
return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration());
return JetCoreEnvironment.createForTests(getTestRootDisposable(), new CompilerConfiguration());
}
}
@@ -59,7 +59,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
@Override
protected JetCoreEnvironment createEnvironment() {
return new JetCoreEnvironment(getTestRootDisposable(), new CompilerConfiguration());
return JetCoreEnvironment.createForTests(getTestRootDisposable(), new CompilerConfiguration());
}
@NotNull