store CompilerDependencies in JetCoreEnvironment
This commit is contained in:
@@ -52,7 +52,7 @@ public class BytecodeCompiler {
|
||||
private CompileEnvironmentConfiguration env( String stdlib, String[] classpath ) {
|
||||
CompilerDependencies dependencies = CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR);
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(CompileEnvironmentUtil.createMockDisposable(), dependencies);
|
||||
CompileEnvironmentConfiguration env = new CompileEnvironmentConfiguration(environment, dependencies, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
CompileEnvironmentConfiguration env = new CompileEnvironmentConfiguration(environment, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
|
||||
if (( stdlib != null ) && ( stdlib.trim().length() > 0 )) {
|
||||
File file = new File(stdlib);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class K2JVMCompiler {
|
||||
Disposable rootDisposable = CompileEnvironmentUtil.createMockDisposable();
|
||||
|
||||
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, dependencies);
|
||||
CompileEnvironmentConfiguration configuration = new CompileEnvironmentConfiguration(environment, dependencies, messageCollector);
|
||||
CompileEnvironmentConfiguration configuration = new CompileEnvironmentConfiguration(environment, messageCollector);
|
||||
|
||||
messageCollector.report(CompilerMessageSeverity.LOGGING, "Configuring the compilation environment",
|
||||
CompilerMessageLocation.NO_LOCATION);
|
||||
@@ -243,8 +243,8 @@ public class K2JVMCompiler {
|
||||
configuration.getCompilerPlugins().addAll(plugins);
|
||||
}
|
||||
|
||||
if (configuration.getCompilerDependencies().getRuntimeJar() != null) {
|
||||
CompileEnvironmentUtil.addToClasspath(configuration.getEnvironment(), configuration.getCompilerDependencies().getRuntimeJar());
|
||||
if (configuration.getEnvironment().getCompilerDependencies().getRuntimeJar() != null) {
|
||||
CompileEnvironmentUtil.addToClasspath(configuration.getEnvironment(), configuration.getEnvironment().getCompilerDependencies().getRuntimeJar());
|
||||
}
|
||||
|
||||
if (arguments.classpath != null) {
|
||||
|
||||
+4
-9
@@ -29,8 +29,9 @@ import java.util.List;
|
||||
* @author abreslav
|
||||
*/
|
||||
public class CompileEnvironmentConfiguration {
|
||||
@NotNull
|
||||
private final JetCoreEnvironment environment;
|
||||
private final CompilerDependencies compilerDependencies;
|
||||
@NotNull
|
||||
private final MessageCollector messageCollector;
|
||||
|
||||
private List<CompilerPlugin> compilerPlugins = Lists.newArrayList();
|
||||
@@ -39,22 +40,16 @@ public class CompileEnvironmentConfiguration {
|
||||
* NOTE: It's very important to call dispose for every object of this class or there will be memory leaks.
|
||||
* @see Disposer
|
||||
*/
|
||||
public CompileEnvironmentConfiguration(@NotNull JetCoreEnvironment environment,
|
||||
@NotNull CompilerDependencies compilerDependencies, @NotNull MessageCollector messageCollector) {
|
||||
public CompileEnvironmentConfiguration(@NotNull JetCoreEnvironment environment, @NotNull MessageCollector messageCollector) {
|
||||
this.messageCollector = messageCollector;
|
||||
this.compilerDependencies = compilerDependencies;
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JetCoreEnvironment getEnvironment() {
|
||||
return environment;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CompilerDependencies getCompilerDependencies() {
|
||||
return compilerDependencies;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public MessageCollector getMessageCollector() {
|
||||
return messageCollector;
|
||||
|
||||
@@ -162,7 +162,7 @@ public class CompileEnvironmentUtil {
|
||||
scriptEnvironment.addSources(moduleScriptFile);
|
||||
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler
|
||||
.analyzeAndGenerate(new CompileEnvironmentConfiguration(scriptEnvironment, dependencies, messageCollector), false);
|
||||
.analyzeAndGenerate(new CompileEnvironmentConfiguration(scriptEnvironment, messageCollector), false);
|
||||
if (generationState == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,14 @@ import java.util.List;
|
||||
public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
private final List<JetFile> sourceFiles = new ArrayList<JetFile>();
|
||||
|
||||
@NotNull
|
||||
private final CompilerDependencies compilerDependencies;
|
||||
|
||||
public JetCoreEnvironment(Disposable parentDisposable, @NotNull CompilerDependencies compilerDependencies) {
|
||||
super(parentDisposable);
|
||||
|
||||
this.compilerDependencies = compilerDependencies;
|
||||
|
||||
registerFileType(JetFileType.INSTANCE, "kt");
|
||||
registerFileType(JetFileType.INSTANCE, "kts");
|
||||
registerFileType(JetFileType.INSTANCE, "ktm");
|
||||
@@ -152,4 +158,9 @@ public class JetCoreEnvironment extends JavaCoreEnvironment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CompilerDependencies getCompilerDependencies() {
|
||||
return compilerDependencies;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -83,7 +83,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
configuration.getEnvironment().addToClasspath(new File(classpathRoot));
|
||||
}
|
||||
|
||||
CompileEnvironmentUtil.ensureRuntime(configuration.getEnvironment(), configuration.getCompilerDependencies());
|
||||
CompileEnvironmentUtil.ensureRuntime(configuration.getEnvironment(), configuration.getEnvironment().getCompilerDependencies());
|
||||
|
||||
GenerationState generationState = analyzeAndGenerate(configuration);
|
||||
if (generationState == null) {
|
||||
@@ -104,9 +104,9 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
|
||||
for (Module moduleBuilder : modules) {
|
||||
// TODO: this should be done only once for the environment
|
||||
if (configuration.getCompilerDependencies().getRuntimeJar() != null) {
|
||||
if (configuration.getEnvironment().getCompilerDependencies().getRuntimeJar() != null) {
|
||||
CompileEnvironmentUtil
|
||||
.addToClasspath(configuration.getEnvironment(), configuration.getCompilerDependencies().getRuntimeJar());
|
||||
.addToClasspath(configuration.getEnvironment(), configuration.getEnvironment().getCompilerDependencies().getRuntimeJar());
|
||||
}
|
||||
ClassFileFactory moduleFactory = compileModule(configuration, moduleBuilder, directory);
|
||||
if (moduleFactory == null) {
|
||||
@@ -143,7 +143,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
CompileEnvironmentUtil.ensureRuntime(configuration.getEnvironment(), configuration.getCompilerDependencies());
|
||||
CompileEnvironmentUtil.ensureRuntime(configuration.getEnvironment(), configuration.getEnvironment().getCompilerDependencies());
|
||||
|
||||
GenerationState generationState = analyzeAndGenerate(configuration);
|
||||
if (generationState == null) {
|
||||
@@ -209,7 +209,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
|
||||
@Nullable
|
||||
public static GenerationState analyzeAndGenerate(CompileEnvironmentConfiguration configuration) {
|
||||
return analyzeAndGenerate(configuration, configuration.getCompilerDependencies().getCompilerSpecialMode().isStubs());
|
||||
return analyzeAndGenerate(configuration, configuration.getEnvironment().getCompilerDependencies().getCompilerSpecialMode().isStubs());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -244,7 +244,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
return AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
environment.getProject(), environment.getSourceFiles(), filesToAnalyzeCompletely,
|
||||
JetControlFlowDataTraceFactory.EMPTY,
|
||||
configuration.getCompilerDependencies());
|
||||
configuration.getEnvironment().getCompilerDependencies());
|
||||
}
|
||||
}, environment.getSourceFiles()
|
||||
);
|
||||
@@ -267,7 +267,7 @@ public class KotlinToJVMBytecodeCompiler {
|
||||
};
|
||||
GenerationState generationState = new GenerationState(project, ClassBuilderFactories.binaries(stubs), backendProgress,
|
||||
exhaust, environment.getSourceFiles(),
|
||||
configuration.getCompilerDependencies().getCompilerSpecialMode());
|
||||
configuration.getEnvironment().getCompilerDependencies().getCompilerSpecialMode());
|
||||
generationState.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
|
||||
List<CompilerPlugin> plugins = configuration.getCompilerPlugins();
|
||||
|
||||
@@ -175,7 +175,7 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
|
||||
getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true))
|
||||
myEnvironment.getCompilerDependencies())
|
||||
.getBindingContext();
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class JavaDescriptorResolverTest extends TestCaseWithTmpdir {
|
||||
jetCoreEnvironment.addToClasspath(tmpdir);
|
||||
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, true), jetCoreEnvironment.getProject());
|
||||
jetCoreEnvironment.getCompilerDependencies(), jetCoreEnvironment.getProject());
|
||||
JavaDescriptorResolver javaDescriptorResolver = injector.getJavaDescriptorResolver();
|
||||
ClassDescriptor classDescriptor = javaDescriptorResolver.resolveClass(fqName, DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN);
|
||||
Assert.assertNotNull(classDescriptor);
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ReadJavaBinaryClassTest extends TestCaseWithTmpdir {
|
||||
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
psiFile, JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, true))
|
||||
jetCoreEnvironment.getCompilerDependencies())
|
||||
.getBindingContext();
|
||||
return bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, FqName.topLevel("test"));
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class ReadJavaBinaryClassTest extends TestCaseWithTmpdir {
|
||||
jetCoreEnvironment.addToClasspath(new File("out/production/runtime"));
|
||||
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, true), jetCoreEnvironment.getProject());
|
||||
jetCoreEnvironment.getCompilerDependencies(), jetCoreEnvironment.getProject());
|
||||
JavaDescriptorResolver javaDescriptorResolver = injector.getJavaDescriptorResolver();
|
||||
return javaDescriptorResolver.resolveNamespace(FqName.topLevel("test"), DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ReadKotlinBinaryClassTest extends TestCaseWithTmpdir {
|
||||
jetCoreEnvironment.addToClasspath(new File("out/production/runtime"));
|
||||
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.JDK_HEADERS, true), jetCoreEnvironment.getProject());
|
||||
jetCoreEnvironment.getCompilerDependencies(), jetCoreEnvironment.getProject());
|
||||
JavaDescriptorResolver javaDescriptorResolver = injector.getJavaDescriptorResolver();
|
||||
NamespaceDescriptor namespaceFromClass = javaDescriptorResolver.resolveNamespace(FqName.topLevel("test"), DescriptorSearchRule.ERROR_IF_FOUND_IN_KOTLIN);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public abstract class CodegenTestCase extends JetLiteFixture {
|
||||
private GenerationState generateCommon(ClassBuilderFactory classBuilderFactory) {
|
||||
final AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
myFile, JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false));
|
||||
myEnvironment.getCompilerDependencies());
|
||||
analyzeExhaust.throwIfError();
|
||||
GenerationState state = new GenerationState(getProject(), classBuilderFactory, analyzeExhaust, Collections.singletonList(myFile));
|
||||
state.compileCorrectFiles(CompilationErrorHandler.THROW_EXCEPTION);
|
||||
|
||||
@@ -16,14 +16,9 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentConfiguration;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentUtil;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
import org.jetbrains.jet.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -32,8 +27,8 @@ public class CompileTextTest extends CodegenTestCase {
|
||||
public void testMe() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
createEnvironmentWithMockJdk();
|
||||
String text = "import org.jetbrains.jet.codegen.CompileTextTest; fun x() = CompileTextTest()";
|
||||
CompilerDependencies dependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false);
|
||||
CompileEnvironmentConfiguration configuration = new CompileEnvironmentConfiguration(myEnvironment, dependencies, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
CompileEnvironmentConfiguration configuration = new CompileEnvironmentConfiguration(
|
||||
myEnvironment, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR);
|
||||
configuration.getEnvironment().addToClasspathFromClassLoader(getClass().getClassLoader());
|
||||
ClassLoader classLoader = KotlinToJVMBytecodeCompiler.compileText(configuration, text);
|
||||
Class<?> namespace = classLoader.loadClass("namespace");
|
||||
|
||||
@@ -21,7 +21,6 @@ import gnu.trove.THashSet;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.codegen.forTestCompile.ForTestCompileRuntime;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentConfiguration;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.KotlinToJVMBytecodeCompiler;
|
||||
@@ -32,8 +31,6 @@ import org.jetbrains.jet.lang.psi.JetDeclaration;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
import org.jetbrains.jet.parsing.JetParsingTest;
|
||||
|
||||
@@ -75,7 +72,6 @@ public class TestlibTest extends CodegenTestCase {
|
||||
|
||||
private TestSuite doBuildSuite() {
|
||||
try {
|
||||
CompilerDependencies compilerDependencies = CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, false);
|
||||
File junitJar = new File("libraries/lib/junit-4.9.jar");
|
||||
|
||||
if (!junitJar.exists()) {
|
||||
@@ -84,14 +80,14 @@ public class TestlibTest extends CodegenTestCase {
|
||||
|
||||
myEnvironment.addToClasspath(junitJar);
|
||||
|
||||
myEnvironment.addToClasspath(compilerDependencies.getRuntimeJar());
|
||||
myEnvironment.addToClasspath(myEnvironment.getCompilerDependencies().getRuntimeJar());
|
||||
|
||||
CoreLocalFileSystem localFileSystem = myEnvironment.getLocalFileSystem();
|
||||
myEnvironment.addSources(localFileSystem.findFileByPath(JetParsingTest.getTestDataDir() + "/../../libraries/stdlib/test"));
|
||||
myEnvironment.addSources(localFileSystem.findFileByPath(JetParsingTest.getTestDataDir() + "/../../libraries/kunit/src"));
|
||||
|
||||
GenerationState generationState = KotlinToJVMBytecodeCompiler
|
||||
.analyzeAndGenerate(new CompileEnvironmentConfiguration(myEnvironment, compilerDependencies, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR), false);
|
||||
.analyzeAndGenerate(new CompileEnvironmentConfiguration(myEnvironment, MessageCollector.PLAIN_TEXT_TO_SYSTEM_ERR), false);
|
||||
|
||||
if (generationState == null) {
|
||||
throw new RuntimeException("There were compilation errors");
|
||||
|
||||
@@ -80,7 +80,7 @@ public class DescriptorRendererTest extends JetLiteFixture {
|
||||
AnalyzeExhaust analyzeExhaust =
|
||||
AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(
|
||||
(JetFile) psiFile, JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true));
|
||||
myEnvironment.getCompilerDependencies());
|
||||
final BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
|
||||
psiFile.acceptChildren(new JetVisitorVoid() {
|
||||
|
||||
@@ -79,9 +79,13 @@ public abstract class ExpectedResolveData {
|
||||
private final Map<String, DeclarationDescriptor> nameToDescriptor;
|
||||
private final Map<String, PsiElement> nameToPsiElement;
|
||||
|
||||
public ExpectedResolveData(Map<String, DeclarationDescriptor> nameToDescriptor, Map<String, PsiElement> nameToPsiElement) {
|
||||
@NotNull
|
||||
private final JetCoreEnvironment jetCoreEnvironment;
|
||||
|
||||
public ExpectedResolveData(Map<String, DeclarationDescriptor> nameToDescriptor, Map<String, PsiElement> nameToPsiElement, @NotNull JetCoreEnvironment environment) {
|
||||
this.nameToDescriptor = nameToDescriptor;
|
||||
this.nameToPsiElement = nameToPsiElement;
|
||||
jetCoreEnvironment = environment;
|
||||
}
|
||||
|
||||
public final JetFile createFileFromMarkedUpText(String fileName, String text) {
|
||||
@@ -144,7 +148,7 @@ public abstract class ExpectedResolveData {
|
||||
|
||||
AnalyzeExhaust analyzeExhaust = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(project, files,
|
||||
Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true));
|
||||
jetCoreEnvironment.getCompilerDependencies());
|
||||
BindingContext bindingContext = analyzeExhaust.getBindingContext();
|
||||
for (Diagnostic diagnostic : bindingContext.getDiagnostics()) {
|
||||
if (diagnostic.getFactory() instanceof UnresolvedReferenceDiagnosticFactory) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.CompileCompilerDependenciesTest;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.di.InjectorForJavaSemanticServices;
|
||||
import org.jetbrains.jet.di.InjectorForTests;
|
||||
@@ -37,8 +36,6 @@ import org.jetbrains.jet.lang.resolve.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.calls.CallResolver;
|
||||
import org.jetbrains.jet.lang.resolve.calls.OverloadResolutionResults;
|
||||
import org.jetbrains.jet.lang.resolve.calls.ResolvedCall;
|
||||
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.java.PsiClassFinder;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||
import org.jetbrains.jet.lang.types.JetType;
|
||||
@@ -103,7 +100,7 @@ public class JetResolveTest extends ExtensibleResolveTestCase {
|
||||
nameToDeclaration.put("java::java.lang.Number", java_lang_Number);
|
||||
nameToDeclaration.put("java::java.lang.Number.intValue()", java_lang_Number.findMethodsByName("intValue", true)[0]);
|
||||
|
||||
return new ExpectedResolveData(nameToDescriptor, nameToDeclaration) {
|
||||
return new ExpectedResolveData(nameToDescriptor, nameToDeclaration, myEnvironment) {
|
||||
@Override
|
||||
protected JetFile createJetFile(String fileName, String text) {
|
||||
return createCheckAndReturnPsiFile(fileName, text);
|
||||
@@ -127,7 +124,7 @@ public class JetResolveTest extends ExtensibleResolveTestCase {
|
||||
private PsiClass findClass(String qualifiedName) {
|
||||
Project project = getProject();
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true), project);
|
||||
myEnvironment.getCompilerDependencies(), project);
|
||||
return injector.getPsiClassFinderForJvm().findPsiClass(new FqName(qualifiedName), PsiClassFinder.RuntimeClassesHandleMode.THROW);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
|
||||
assert aClass instanceof JetClass;
|
||||
AnalyzeExhaust bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file,
|
||||
JetControlFlowDataTraceFactory.EMPTY,
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true));
|
||||
myEnvironment.getCompilerDependencies());
|
||||
DeclarationDescriptor classDescriptor = bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass);
|
||||
WritableScopeImpl scope = new WritableScopeImpl(libraryScope, root, RedeclarationHandler.DO_NOTHING);
|
||||
assert classDescriptor instanceof ClassifierDescriptor;
|
||||
|
||||
@@ -590,7 +590,7 @@ public class JetTypeCheckerTest extends JetLiteFixture {
|
||||
WritableScopeImpl writableScope = new WritableScopeImpl(scope, scope.getContainingDeclaration(), RedeclarationHandler.DO_NOTHING);
|
||||
writableScope.importScope(library.getLibraryScope());
|
||||
InjectorForJavaSemanticServices injector = new InjectorForJavaSemanticServices(
|
||||
CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR, true), getProject());
|
||||
myEnvironment.getCompilerDependencies(), getProject());
|
||||
JavaDescriptorResolver javaDescriptorResolver = injector.getJavaDescriptorResolver();
|
||||
writableScope.importScope(javaDescriptorResolver.resolveNamespace(FqName.ROOT,
|
||||
DescriptorSearchRule.INCLUDE_KOTLIN).getMemberScope());
|
||||
|
||||
Reference in New Issue
Block a user