Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
b109ac5a
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b109ac5a
编写于
5月 01, 2012
作者:
S
Stepan Koltsov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
store CompilerDependencies in JetCoreEnvironment
上级
ba7a94e1
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
48 addition
and
50 deletion
+48
-50
build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
...c/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
+1
-1
compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java
...iler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java
+3
-3
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CompileEnvironmentConfiguration.java
...jet/cli/jvm/compiler/CompileEnvironmentConfiguration.java
+4
-9
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CompileEnvironmentUtil.java
...etbrains/jet/cli/jvm/compiler/CompileEnvironmentUtil.java
+1
-1
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
...rg/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
+11
-0
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java
...ins/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java
+7
-7
compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java
.../tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java
+1
-1
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/JavaDescriptorResolverTest.java
...ains/jet/cli/jvm/compiler/JavaDescriptorResolverTest.java
+1
-1
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/ReadJavaBinaryClassTest.java
...tbrains/jet/cli/jvm/compiler/ReadJavaBinaryClassTest.java
+2
-2
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/ReadKotlinBinaryClassTest.java
...rains/jet/cli/jvm/compiler/ReadKotlinBinaryClassTest.java
+1
-1
compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
...iler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
+1
-1
compiler/tests/org/jetbrains/jet/codegen/CompileTextTest.java
...iler/tests/org/jetbrains/jet/codegen/CompileTextTest.java
+2
-7
compiler/tests/org/jetbrains/jet/codegen/TestlibTest.java
compiler/tests/org/jetbrains/jet/codegen/TestlibTest.java
+2
-6
compiler/tests/org/jetbrains/jet/resolve/DescriptorRendererTest.java
...sts/org/jetbrains/jet/resolve/DescriptorRendererTest.java
+1
-1
compiler/tests/org/jetbrains/jet/resolve/ExpectedResolveData.java
.../tests/org/jetbrains/jet/resolve/ExpectedResolveData.java
+6
-2
compiler/tests/org/jetbrains/jet/resolve/JetResolveTest.java
compiler/tests/org/jetbrains/jet/resolve/JetResolveTest.java
+2
-5
compiler/tests/org/jetbrains/jet/types/JetDefaultModalityModifiersTest.java
.../jetbrains/jet/types/JetDefaultModalityModifiersTest.java
+1
-1
compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java
...ler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java
+1
-1
未找到文件。
build-tools/core/src/org/jetbrains/jet/buildtools/core/BytecodeCompiler.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
...
...
compiler/cli/src/org/jetbrains/jet/cli/jvm/K2JVMCompiler.java
浏览文件 @
b109ac5a
...
...
@@ -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
.
get
Environment
().
get
CompilerDependencies
().
getRuntimeJar
()
!=
null
)
{
CompileEnvironmentUtil
.
addToClasspath
(
configuration
.
getEnvironment
(),
configuration
.
get
Environment
().
get
CompilerDependencies
().
getRuntimeJar
());
}
if
(
arguments
.
classpath
!=
null
)
{
...
...
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CompileEnvironmentConfiguration.java
浏览文件 @
b109ac5a
...
...
@@ -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
;
...
...
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/CompileEnvironmentUtil.java
浏览文件 @
b109ac5a
...
...
@@ -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
;
}
...
...
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
浏览文件 @
b109ac5a
...
...
@@ -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
;
}
}
compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/KotlinToJVMBytecodeCompiler.java
浏览文件 @
b109ac5a
...
...
@@ -83,7 +83,7 @@ public class KotlinToJVMBytecodeCompiler {
configuration
.
getEnvironment
().
addToClasspath
(
new
File
(
classpathRoot
));
}
CompileEnvironmentUtil
.
ensureRuntime
(
configuration
.
getEnvironment
(),
configuration
.
getCompilerDependencies
());
CompileEnvironmentUtil
.
ensureRuntime
(
configuration
.
getEnvironment
(),
configuration
.
get
Environment
().
get
CompilerDependencies
());
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
.
get
Environment
().
get
CompilerDependencies
().
getRuntimeJar
()
!=
null
)
{
CompileEnvironmentUtil
.
addToClasspath
(
configuration
.
getEnvironment
(),
configuration
.
getCompilerDependencies
().
getRuntimeJar
());
.
addToClasspath
(
configuration
.
getEnvironment
(),
configuration
.
get
Environment
().
get
CompilerDependencies
().
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
.
get
Environment
().
get
CompilerDependencies
());
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
.
get
Environment
().
get
CompilerDependencies
().
getCompilerSpecialMode
().
isStubs
());
}
@Nullable
...
...
@@ -244,7 +244,7 @@ public class KotlinToJVMBytecodeCompiler {
return
AnalyzerFacadeForJVM
.
analyzeFilesWithJavaIntegration
(
environment
.
getProject
(),
environment
.
getSourceFiles
(),
filesToAnalyzeCompletely
,
JetControlFlowDataTraceFactory
.
EMPTY
,
configuration
.
getCompilerDependencies
());
configuration
.
get
Environment
().
get
CompilerDependencies
());
}
},
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
.
get
Environment
().
get
CompilerDependencies
().
getCompilerSpecialMode
());
generationState
.
compileCorrectFiles
(
CompilationErrorHandler
.
THROW_EXCEPTION
);
List
<
CompilerPlugin
>
plugins
=
configuration
.
getCompilerPlugins
();
...
...
compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
;
...
...
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/JavaDescriptorResolverTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
...
...
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/ReadJavaBinaryClassTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
}
...
...
compiler/tests/org/jetbrains/jet/cli/jvm/compiler/ReadKotlinBinaryClassTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
...
...
compiler/tests/org/jetbrains/jet/codegen/CodegenTestCase.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
...
...
compiler/tests/org/jetbrains/jet/codegen/CompileTextTest.java
浏览文件 @
b109ac5a
...
...
@@ -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()"
;
Compile
rDependencies
dependencies
=
CompileCompilerDependenciesTest
.
compilerDependenciesForTests
(
CompilerSpecialMode
.
REGULAR
,
false
);
CompileEnvironmentConfiguration
configuration
=
new
CompileEnvironmentConfiguration
(
myEnvironment
,
dependencies
,
MessageCollector
.
PLAIN_TEXT_TO_SYSTEM_ERR
);
Compile
EnvironmentConfiguration
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"
);
...
...
compiler/tests/org/jetbrains/jet/codegen/TestlibTest.java
浏览文件 @
b109ac5a
...
...
@@ -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"
);
...
...
compiler/tests/org/jetbrains/jet/resolve/DescriptorRendererTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
()
{
...
...
compiler/tests/org/jetbrains/jet/resolve/ExpectedResolveData.java
浏览文件 @
b109ac5a
...
...
@@ -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
)
{
...
...
compiler/tests/org/jetbrains/jet/resolve/JetResolveTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
);
}
...
...
compiler/tests/org/jetbrains/jet/types/JetDefaultModalityModifiersTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
;
...
...
compiler/tests/org/jetbrains/jet/types/JetTypeCheckerTest.java
浏览文件 @
b109ac5a
...
...
@@ -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
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录